>>
|
No. 36
Try these links. I haven't read through them completely, but they seem to try to break down the OO concept for beginners. Maybe they will work for you.
http://www.suite101.com/content/understanding-object-oriented-programming-a127536
http://www.inf.ufsc.br/poo/smalltalk/ibm/tutorial/oop.html
http://www.codeproject.com/KB/architecture/OO.aspx
So for C++, this might be something like:
Class Person { .. }
// protected: int age; char * name; int gender;
// public: int getAge(); char * getName(); int getGender();
Class Employee : public Person { .. }
// private: char * employer; int yearsEmployed;
// public: char * getEmployer(); int getYearsEmployed();
The Person class is the blueprint for a generic person. It can be considered a small program in its own right because hit has data (name, age, gender), and methods that work on that data (getAge, getName, getGender).
The Employee class is an extension of the Person class, since employees are people, too. Because it's an extension of the Person class, it has access to all public and protected data and methods from the Person class, and adds its own data and methods. This reduces the need for duplicated effort - you only add what parts make the new class unique..
This is just a basic idea, but maybe it will help. Also, my command of C++ is very rusty, so hopefully the previous links and book will be more clear for you.
Good luck!
|