Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Superclass vs. Subclass structures
Message
From
28/10/1998 19:55:51
 
 
To
28/10/1998 17:15:54
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00151975
Message ID:
00152053
Views:
29
I'd pick #2. Suppose that we know that we must move. Implicit in move is how far, how fast, when to start, when to stop, and maximum speed. Suppose the task of move() was to calculate some missing value in the above properties. Appropriate formulae can be placed in the move method to perform calculations. Subclasses of such an item would alter the formulae (polymorph the method) and use the same property settings (inherit properties) or inherit the method and alter the property settings. Since Fly(), Drive() or Row() all must change or use all the properties listed, there would be no need for them idividually we would just use move(). If different formulae were called for to Fly(), Drive(), or Row(), We would alter the method in the subclass but still use the same properties and we might still be able to use some of the code already present in the superclass.
Terry Rooks
Software Systems Architect
Microsoft Certified Solution Developer.Net

If at first you don't succeed, then skydiving definitely isn't for you.
Previous
Reply
Map
View

Click here to load this message in the networking platform