C++ Objects

Variables define the state of the object,  function define what action
to be performed on variables.Thus, We can say that a program is formed
by interrelated object.
An object can be constructed, destroyed and copied into another object
We can create object using the constructor and destroyed by

Pointer to C++ Objects
C++ Objects created by class can be pointed by the pointer.
Example of C++ Objects :-
abc x;
abc is the class and x is the object defined to be of type abc.
We can define pointer also.
abc *ptr;
The pointer to an object of class variable can be accessed
in the following two ways.
(1) (*object_name).nameof_member=variable;
(2) object_name -> nameof_member=variable;
The period(.) has a higher precedence over the indirection Operator(*).

Follow Us

Contact Us


Back to Top