if object stores address of other object of same class name then it is called as self reference class.
A self-referential class is one that has a member variable (pointer variable or object) should contain the same class name.
Example:
class node //here node is self referential class
{
private:
int data;
node * link; //here link pointer is of type node class
};
A self-referential class is one that has a member variable (pointer variable or object) should contain the same class name.
Example:
class node //here node is self referential class
{
private:
int data;
node * link; //here link pointer is of type node class
};
No comments:
Post a Comment