I design a class "Item", and two classes "Table", "Chair" inherited from class "Item".
I want to make a linked list that each node can be "Table" or "Chair", so I decide to use the linked list of "Item", hope that each object can be declared like this:
Item one_node = new Table();
But then, I can not use the variable "one_node" as an object of "Table".
That is my problem. Anyone can help me to create a linked list where each node can be an object of some classes inherited from one class? And can the depth of the inheritance be more than one?
Sorry if my english is bad.
0 · ·