class type pointer

hi programmers i want to something in given code example
i've created a pointer of type understand in private section why we do that i mean what is mean by that
what is the purpose of that pointer
1
2
3
4
5
6
7
8
9
10
11
12
13
lass understand{
public:
	understand()
	{
		obj = 12;
		cout<<"COnstructor Called"<<endl;
	}

private:
	understand * c;
	int obj;

};
Last edited on
This is example. It does not have any meaning. But consider following example:
1
2
3
4
5
6
7
8
9
template<class T>
class Node
{
    T* data;
    Node<T>* previous;
    Node<T>* next;
public:
//...
};

There class Node<T> have pointers to Node<T>. You will use them to link different nodes together and create a Linked List.
OK thanks i want ask one more thing in main or some other function if we declare to pointer of type node
like
NOde * a and Node * b
the we write a = b what does this statement mean is it giving the address of b to a or something else
a is a pointer, like a note with an address. You changing it to point to data b points to, like writing down new address of your friend, who have moved from rturn addrss of a letter.
Last edited on
Topic archived. No new replies allowed.