04/07/06 Lecture Notes, CISC181 Classes! We extend C++ with a new data type by adding a "class". The basic syntax is the following: class Complex_C { public: // in here will go member functions // member functions are also called methods private: // in here will go data members // data members are also called attributes }; Object Oriented Programming has four main features: * Encapsulation * Information Hiding * Inheritance * Polymorphism Encapsulation: define functions and data _together_ in one syntactic unit. Information Hiding: classes have a public and a private part public part is all users get to see private internal details are hidden from users Like on a car: everyone who drives understands: steering wheel brake gas pedal gear shift ignition light switch But not everyone understands---or even needs to understand: torque converter piston fuel injector etc. Constructors: special member functions "construct" a new instance of a class. instances are "individuals"... specific variables in memory that are instances of the class Defining a class creates no instances.. You have to "instantiate" the class to create an instance. Read Chapters 6, 7, 8