What is use of abstract variable

What is use of abstract variable

Answer: The idea of abstract classes is that they can contain some behavior or data which you require all sub-classes to contain. Think of the simple example of WheeledVehicle – it should have a numWheels member variable. You want all sub classes to have this variable. Remember that abstract classes are a very useful feature when developing APIs, as they can ensure that people who extend your API won’t break it.

Leave a Reply

Your email address will not be published. Required fields are marked *