aspose file tools*
The moose likes Beginning Java and the fly likes Example for OOPs concepts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Example for OOPs concepts" Watch "Example for OOPs concepts" New topic
Author

Example for OOPs concepts

shalini sharma
Greenhorn

Joined: Nov 21, 2002
Posts: 26
Hi All,
To explain all the concepts of OOPs princples, can any one suggest an example ( to a computer science student).
I think some thing like Car or Animal can be used as an example to explain all the three princples of OOPs concepts.
Any suggests will be helpful,
Thanks
Regards
Jyothy
PS: Since Java is based on OOPs concept, I posted this here.
Francis Siu
Ranch Hand

Joined: Jan 04, 2003
Posts: 867
Encapsulation is the 1st principle of OOP. Client Oriented Design is the 2nd.
But I do not remenber the 3rd and the details of these


Francis Siu
SCJP, MCDBA
subhit chauhan
Ranch Hand

Joined: Jun 20, 2002
Posts: 40
Hey sui, jyothy is asking an example for three principles and not the three principles...
BTW 3 principles on which oops is based on are.
encapsulation, inheritance and polymorphism..
A Car radio is the best example for explanning all of these 3 concepts.
shalini sharma
Greenhorn

Joined: Nov 21, 2002
Posts: 26
Hi,
will Stack be a good example for explaining th OOps concepts.
The variables are declared as private and Push and Pop are declared as public methods to access the data ( Encapsulation).
Defining different kinds of stacks ( Integer, float, char)( Inheritance and polymorphism)
Thanks
Jyothy
aadhi agathi
Ranch Hand

Joined: Apr 29, 2002
Posts: 263
Originally posted by Jyothy kidambhi:
Hi All,
To explain all the concepts of OOPs princples, can any one suggest an example ( to a computer science student).

Other than the humble PIE , there are lot more to OOPS like abstraction, service definition(interfaces), object interaction etc... which cant be defined in a single example.

I think some thing like Car or Animal can be used as an example to explain all the three princples of OOPs concepts.

i would strogly suggest that giving an example of real time will lead them to the wrong way of thinking inheritance,IMHO. try to start with an existing concept like a stack, analyze the issues with procedural design and build on that to an object. just saying A is B, A is composed of A1,A2 etc... is not a big deal but knowing how to make "objects interact" is the essence and abstracting the concept in the object is the real one.


Aadhi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Example for OOPs concepts