public void start() { Parent p = new Parent(); Son s = new Son(); p.display(); // In Parent. x = 10 s.display(); // In Son. x = 20 p.Show(); // Show In Parent.x = 10 s.Show(); // Show In Son.x = 20 Parent p1 = new Son(); p1.display(); // In Parent. x = 10 p1.Show(); // Show In Parent.x = 10 }
public void start() { Parent p = new Parent(); Son s = new Son(); p.Display(); //Display In Parent.x = 10 p.Test(); //Test In Parent.x = 10 p.Show(); //Show In Parent. x = 10 s.Display(); //Display In Parent.x = 10 s.Test(); //Test In Parent.x = 10 s.Show(); //Show In Son. x = 20 Parent p1 = new Son(); p1.Display(); //Display In Parent.x = 10 p1.Test(); //Test In Parent.x = 10 p1.Show(); //Show In Son. x = 20 }