Announcements and Reminders
The Textbook: Professional C++ by Marc Gregoire - how to use it
The Course Notes ( MS Word Document PDF File ) - how to use it / expect updates throughout the quarter
Academic Integrity Policy
Computer Lab Hours
Monday – Thursday 9 am – 8 pm
Friday 9 am – 4 pm
Saturday and Sunday CLOSED
Computer Lab Rules
Classes, Constructors, and Desctructors
Example 1-1 – Card and Deck class (old code)
Example 1-2 – Card and Deck class (revised)
Example 1-3 – Card and Deck class (another revision)
Example 1-4 – Adding Matrices
Maybe You Haven’t Covered This
Example 1-5 - Conversion of a user-defined type to a primitive type
Example 1-6 - More Conversions of a user-defined type
Explicit ConstructorsThe keyword explicit is used to specify that a constructor may only be used for object instantiation and not for automatic conversion. Here’s an example that demonstrates the effect.
Example 1-7 – Explicit constructors
typedef and usingThe keyword, typedef, originally from C, is used to define a type.
C++ 11 introduced the keyword, using to act like typedef.
typeid operatorThe typeid operator returns an identifier of a type, a variable or an expression. The return of the typeid is a class type, called type_info. You can use the name() member function of the type_info class to display a literal description of the type.
Example 1-8 – typedef, using, typeid