| Author |
need advice on Element and Node
|
Norazanita Adnan
Ranch Hand
Joined: May 28, 2008
Posts: 44
|
|
hi.. is there anything wrong with this code? im confuse here --> is a Element but i the function can receive in as an element, i need receive as an node type. can i declare I know element is the subinterface of node but i dont get get what is the diff when i declare "Element root" instated of "Node root" Hope someone able to advice me on this. thanks in advance.
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16487
|
|
|
It's just basic polymorphism. An Element "IS A" Node, because Element is a subinterface of Node. That means that Element has all the methods that Node does. It also means that Element could have some other methods that Node doesn't have, and in fact it does. It has methods allowing you to access the attributes of the element. Those methods aren't in the Node interface because not all types of nodes have attributes.
|
 |
Norazanita Adnan
Ranch Hand
Joined: May 28, 2008
Posts: 44
|
|
|
thanks..so meaning now it find i declare as Element and send as and Node type..thanks..no i start to like programming....
|
 |
 |
|
|
subject: need advice on Element and Node
|
|
|