RE: If we can'nt make the object of abstract class wha...
Hi This is naveenkumar a for to maintaing some abstraction levels in the class which is abstract suppose in a project there may be more than one person includesall of them should use one of the method then make the super clas as abstract
RE: If we can'nt make the object of abstract class wha...
Eventhough you cant create an instance of abstract class you can create an instance of its super class which inherits the members of the abstract class(sub class) and you can write you code in the data members/methods in super class. You can derive multiple classes from a single abstract class and you can take advantage of the methods that are defined in abstract class.Remeber abstract itself implements hiding implemention details and hence abstract class(hide/restrict the implementation details of all its members).
RE: If we can'nt make the object of abstract class wha...
Eventhough you cant create an instance of abstract class you can create an instance of its super class which inherits the members of the abstract class(sub class) and you can write you code in the data members/methods in super class. You can derive multiple classes from a single abstract class and you can take advantage of the methods that are defined in abstract class.Remeber abstract itself implies hiding implemention details and hence abstract class(hide/restrict the implementation details of all its members). For Example: Assume Car is an abstract class with Odometer Cruise as its members.In MaruthiCar which extends Car can include(define code for) Odomenter in it. In Honda Car Which extends car You can include(define code for) both Odometer and Cruise.
RE: If we can'nt make the object of abstract class wha...
Its basically for Polymorphism So that we can call same method on different classes based on the subtype.Say you implement a factory and get back the subclass requried then u can call the method without any issue as all the subclassed implment the same abstract class.