View Single Post
  #2 (permalink)  
Old 01-06-2008, 12:30 AM
tim's Avatar
tim tim is offline
Senior Member
 
Join Date: Dec 2007
Location: South Africa
Posts: 334
tim is on a distinguished road
Abstract classes
Hello maa11235

It is true that abstract classes cannot be instanced. They are used as a structure to extend from. Abstract classes can contain variables and non-abstract methods. The constructor is used to call the required methods, whether they are abstract or not, and initialize any variables. The reason that an abstract class can have a constructor is so that it's subclass can call that constructor by using the super(<arguments here>) constructor. This style of programming can significantly shorten your code.

Hope that helped.
__________________
If your ship has not come in yet then build a lighthouse.
Reply With Quote