I am new to c++ so here is verry silly question for few of you.
class DList {
public:
struct DNode {
int data;
DNode* next;
DNode* prev;
DNode(DNode* ptr1, DNode* ptr2, int val)
{
next = ptr1;
prev = ptr2;
data = val;
}
~DNode() {}
public:
DNode* getNext() {return next;}
int getNodeVal() {return data;}
};
This is the DList structure for me.suppose i want to use datatype DNode outside this class in some other cpp file to declare data of DNode type.how can i use it.
It’s just a matter of name qualification:
DList::Dnode x;This also works for externally referring to any variables or functions declared statically within the class.