Lecture overview -- Keyboard shortcut: 'u'  Previous page: Preventing object copying -- Keyboard shortcut: 'p'  Next page: Implicit Conversion -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home    Abstraction Mechanisms, Part 1 - slide 18 : 36

Classes and Conversion

Given a user defined type T, programmed via a class or struct:

It is possible to convert from some type S to type T via constructors in T

It is possible to convert from type T to some type S via conversion operators in T

  while (cin >> i)   // convert istream to bool or int
     cout << i*2 << " " << endl;
io-stream-1.cc
The while loop in the context of a full C++ program.