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

OOP question

 
Edward Chen
Ranch Hand
Posts: 798
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is relationship between Class, Object and Instance ?

Could we say Inheritance is opposition to Encapsulation ? because Inheritance expose methods to its child, but Encapsulation try to hide its function.

Thanks.
 
Max Rahder
Ranch Hand
Posts: 177
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The class is the cookie cutter, the object is the cookie. The class is the blueprint, and object is the house. "Object" and "instance" are synonyms.

Inheritance and encapsulation are two characteristics of OOP -- I wouldn't say they are opposites, or that you can't have one without the other. A class that makes good use of inheritance can also be well encapsulated.
 
Raghu Devatha
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Max Rahder wrote: "Object" and "instance" are synonyms.



 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic