I HAVE SPECIFIC QUESTIONS!!!
1. Why do you need Self-Referential Classes? Please provide a "real" life example of when it would be used.
class Node {
public:
Node(int);
void setData(int);
int getData() const;
void setNextPtr( const Node *);
const Node *getNextPtr() const;
private:
int data;
Node *nextPtr;
};
2. ^^^What is a Node, is it just a random name for this Class?
3. what does the (const Node *) mean in:
void setNextPtr(const Node *);
4. why is nextPtr the, "Link?"
I understand Dynamic Memory Allocation, somewhat, but
5. Can somebody break down these two lines of code form me?:
Node *newPtr = new Node(10);
delete newPtr;
DEFINITION
A Linked List is a linear collection of self-referential class objects, called nodes, connected by pointer links.
6. What is that definition REALLY saying (plain english)?
According to my text book, "...if Nodes contain base-class pointers or base-class references to base-class and derived-class objects related by inheritance, we can have a linked list of such nodes and use Virtual Function calls to process these objects polymorphically...."
7. Can you please explain or provide an example of what is really being said here ^^^?
I think I understand how Stacks and Queues work, so I'll leave those alone until I think otherwise, but
8. How does a Tree work and what is it's purpose?
:?: