C c = new C()
- If we know exact runtime type of object then we should use this approach
- by using child reference we can call both parent and child methods
- If we dont know exact runtime type of object then we should use this approach(Polymorphism)
- by using parent reference we can call only methods available in parent class and child class methods we cant call.
No comments:
Post a Comment