Sorry for the confusing title, I am a bit confused myself so I'll just use an example :D Suppose we have:
public abstract class Vehicle {
public abstract void paint();
}
public class Car extends Vehicle {
public void paint() {
...
}
public void sell() {
...
}
}
- Type Car
Car c = new Car();
c.paint();
c.sell(); //works
- Type Vehicle
Vehicle c = new Car();
c.paint();
c.sell(); //error
So what's the point of using the latter format? I can only think of restriction/privacy but even then can't think of a reasonable example. Which option is better to use as general practice?