File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why we need to declare a class abstract??

 
Puneet Mittal
Ranch Hand
Posts: 45
Eclipse IDE Tomcat Server Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi please tell me what is the need of declaring a class abstract???
 
Campbell Ritchie
Sheriff
Pie
Posts: 47258
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I presume you have read this FAQ? You don't "need" to declare a particular class abstract, but there are occasions when you want a "place" in your inheritance hierarchy where you don't want anybody creating instances, or you might have methods which will have such variability that you want them abstract too.
ExampleNow, some behaviour of buses and cars might be the same, some might be different, but you don't want any "Vehicle" objects. So you would probably declare Vehicle abstract. I think, you write the name of abstract classes in italics in a UML diagram.
 
camilo lopes
Ranch Hand
Posts: 202
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when you want to leave that a subclass implements the methods abstract.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic