method to show the tree done
inheritance applied