abstract class

Reply

Join Date: May 2007
Posts: 16
Reputation: tinamary is an unknown quantity at this point 
Solved Threads: 0
tinamary tinamary is offline Offline
Newbie Poster

abstract class

 
0
  #1
Oct 6th, 2007
in abstract class the methods may or may not be implemented, when we implement the methods in the abstract class, then why cant we instantiate objects in for the abstract class. is it mandatory that the objects are not instantiated in abstract class. can anyone tell me the internal working of the abstract class.
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 4,681
Reputation: Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future Ezzaral has a brilliant future 
Solved Threads: 554
Moderator
Featured Poster
Ezzaral's Avatar
Ezzaral Ezzaral is offline Offline
Industrious Poster

Re: abstract class

 
0
  #2
Oct 6th, 2007
If even one method is declared as abstract then the class must be abstract and cannot be directly instantiated. There may be a lot of other functionality in the class, but declaring a method abstract means "this behavior must be specified by a subclass". To instantiate, you must at the very least implement the methods that are declared as abstract in a subclass and thus provide that "missing" behavior of the method. Abstract classes let you code a lot of common functionality into a base class and leave only the specific differences in implementation to be supplied.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1232 | Replies: 1
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC