jQuery in Action, 2nd edition*
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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "OOP question " Watch "OOP question " New topic
Author

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.

Thanks.
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.




dR
 
Don't get me started about those stupid light bulbs.
 
subject: OOP question