abstract ans interface

why do we need to extend some classes and what is the purpose of doing so ,,,,also why we need to implement some classes like class A implements B.
Google up OOP and polymorphism.
We don't need to use object oriented concepts, but we can.

http://en.wikipedia.org/wiki/Object-oriented_design
Basically Polymorphism allows us to use the same piece of code in many ways
For Instance let's say I have a class called Vehicle and it has the members Motor , Gas , and Seat belt.
And you have another class called Car but you do not want to rewrite what could be hundreds of lines of code to implement Motor , Gas , and Seat belt. So Polymorphism comes to the rescue and allows you to use the members in Vehicle and this makes your job much easier because it saves you from rewriting your code for other classes like Hybrid , Moped , Wagon , Scooter , Bike etc.
I hope this helps and if I said anything wrong please tell me.
For more information please go to:
http://www.cplusplus.com/doc/tutorial/polymorphism/
Topic archived. No new replies allowed.