Can we not use an object of the Parent Class in the Child Class and use all its features?
public class Parent {
int name;
}
public class Child extends Parent{
int salary;
}
public class Main {
public static void main(String[] args)
{
Parent parent = new Child();
parent.name= "abcd";
}
}
//This Example show how that case posible.This call dinamic polymorphism.
Comments
Leave a comment