• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Abstract class

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the image below it says :-
With AN abstract class , the guys doing the work at runtime are instances of a subclass of your abstract class?

What does it means?

Can anyone give me a working example of this?
polymorphism2.JPG
[Thumbnail for polymorphism2.JPG]
 
Ranch Hand
Posts: 47
1
IntelliJ IDE Slackware Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, an abstract class cannot be instantiated. Therefor, no Object will ever be instantiated from it. Which is why they are saying,

An abstract class has virtually no use, no value, no purpose in life, unless it is extended.


An example of this would be an abstract Vehicle class...

With this code, we define a Vehicle, but an application can never instantiate a Vehicle because the Vehicle class has been declared abstract. To make use of this class, we must extend it with a subclass, for example...

This Car subclass would be the only class that could be instantiated to an Object at runtime having a Vehicle reference type. This is why they are saying,

With an abstract class, the guys doing the work at runtime are instances of a subclass of your abstract class.

 
Ranch Hand
Posts: 393
9
Open BSD BSD Debian
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Manish Pamnani take a look to About abstract methods and classes  post too  
 
And will you succeed? Yes you will indeed! (98 and 3/4 % guaranteed) - Seuss. tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic