I have been learning and coding in java lately and the object oriented programming concepts are super intresting. Here is one of my new learning:
When you create a reference of the parent class and an object of the child class, you will be able to access the methods of the parent class only. But it is possible to override the method of the parent class in the child class and now the overriden method will only be executed because now it implements dynamic method dispatch.
Phone ph = new SmartPhone();
Phone - parent class
SmartPhone - child class