An abstract class is a class that is declared abstract—it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed.
Then what is the advantage of using abstract vs usual inheritance?
Like sofas, family photo albums, and so on. I, OTOH, got a peace pipe from the 1800s, a Revolutionary War musket, and a bunch of coins from the 1892 Columbian Exposition.
abalfazl hossein
Ranch Hand
Joined: Sep 06, 2007
Posts: 602
posted
0
Dear david
We have a class , and other class can inherited from that.
We have an abstract class. and other class can inherited from that.
The only difference is that we can not create an object of an abstract class.
Now, What is the advantage?If it is about inheritance, Then we can use inheritance as it .When to use abstract?
Abstract class like an interface it provides specification and additionaly it can contain default implementation for a particular method . normally, it can be type for an implementors(classes which extends abstract class) .
*AbstractInterface* is a perfect example for your query . example : AbstractList,AbstractMap ... etc
hth
Ernest Friedman-Hill
author and iconoclast
Marshal