• Upon creation, each element, starting from the first, calls the no-arguments. constructor for itself[r]
(1)(2)Objectives
• Class Basics
– Classes – UML
– Privacy
– Constructors – Destructors
(3)Class Basics
• A class is a derived data type the
members of which are private by default • Classes are much more common in
object-oriented programming than
(4)CLASSES
• The keyword class identifies a class
class Student {
int no; char grade[14]; public:
(5)Instance of a Class(1)
• An instance of a class is called object • The declaration of an instance allocates
memory for the object
• The form of an instance declaration is
Identifier instance;
– Identifier is the name of the class
(6)ARRAYS OF OBJECTS
• An array of objects occupies contiguous memory
• Upon creation, each element, starting from the first, calls the no-arguments
constructor for itself
• Upon destruction, each element, starting from the last element created and
(7)Summary
• Class Basics
– Classes – UML
– Privacy
– Constructors – Destructors
– Arrays of Objects