![]() |
|
|
||||||
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Registered User
![]() Join Date: Dec 2006
Location: Festac Town
Rep Power: 21474865
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
class Engine {}
class Car : public Engine {} class Boat : public Engine {} Leave your comments ![]()
__________________
The Lord is my Shepherd -Psalms 23 http://djmightymike.net http://truspotradio.com http://myspace.com/naijadjs http://myspace.com/dj_mightymike |
|
|
|
|
|
#4 (permalink) |
|
Registered User
|
car is not an engine, boat is not an engine?
__________________
The-All-Swearing-All-Drinking-Heavy-Metal Nigerian http://www.last.fm/user/rush3k/ |
|
|
|
|
|
#5 (permalink) | |
|
Registered User
![]() Join Date: Dec 2006
Location: Festac Town
Rep Power: 21474865
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Quote:
The is an example of a Is a vs has a Relationship Both car and boat are not engines. They should instead have an engine as a component just like in the real world, thus the Psuedocode should have been written something like #include Engine.h Class Boat { public Boat {...} //constructor Somefunctions {..} //some member functions . . . Protected: Engine mEngine; //an instance of engine as a member of Boat More Brain teasers coming ![]()
__________________
The Lord is my Shepherd -Psalms 23 http://djmightymike.net http://truspotradio.com http://myspace.com/naijadjs http://myspace.com/dj_mightymike Last edited by djmightymike; 05-08-2007 at 04:45 PM.. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|