Tuesday, 27 August 2013

A subclass type as parameter type in superclass constructor java

A subclass type as parameter type in superclass constructor java

So I have a node class and I haven't learned Linked List yet, so I can't
use that. To construct a node object I want the parameters to be like
this:
Node(int numberOfNode, type complex or simpel)
I have two subclasses of node called Simpelnode and complexNode and so a
node object can be either one of them. What do I need to do so that the
parameter can be of both types?

No comments:

Post a Comment