File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes OOP question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "OOP question " Watch "OOP question " New topic

OOP question

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
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.

Max Rahder
Ranch Hand

Joined: Nov 06, 2000
Posts: 177
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

Joined: Feb 10, 2009
Posts: 39
Max Rahder wrote: "Object" and "instance" are synonyms.

I agree. Here's the link:
subject: OOP question
It's not a secret anymore!