I've got two class: GraphNode
and BTNode extends GraphNode
. I've got method:
public GraphNode.addChild(GraphNode node)
as GraphNode may have many children and two methods:
public BTNode.addLeftChild(BTNode left)
public BTNode.addRightChild(BTNode right)
as BTNode may have only two children
How may I restrict public access to inherited addChild(GraphNode node)
method from BTNode class? I wouldn't like to have that publicly accessible from that level (while remaining public access from GraphNode class)?