Object Oriented Programming: Lecture 7: Classes and Objects
Object Oriented Programming: Lecture 7: Classes and Objects
Object Oriented Programming: Lecture 7: Classes and Objects
• Each object has its own separate data items, so there must be a separate instance
of each data item for each object.
• However, the member functions are created and placed in memory only once!
int RaceCars::count = 0;
• Putting the definition of static member data outside the class also serves
to emphasize that the memory space for such data is allocated only once
Chapter 10: pg 464, pointers to objects: Object oriented programming in C++ by Robert Lafore 18
Array of pointers (PF)
Collection of addresses
int main()
{
Int *arr_ptr [3];
Int x=0,y=1,z=3;
arr_ptr[0]=&x;
arr_ptr[1]=&y;
arr_ptr[2]=&z;
return 0;
}