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.
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.
Joined: Nov 21, 2002
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
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.