Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Superclass vs. Subclass structures
Message
 
 
To
28/10/1998 17:15:54
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00151975
Message ID:
00152024
Views:
22
John,

If you are only talking inheritance. #2 Vehicle provides the interface via abstract method definitions ie Move(). The subclasses provide the concrete implementations of the Move() method.

It's also these type of examples that I think are harder for database people to grasp in terms of problem domain. *s*

If you're not only talking inheritance various patterns solve this problem various ways.

>Another design abstract problem. Let us say that we have a class called Airplane that's parent class is Vehicle. All Vehicles derived classes Move. How they move is quite different: Airplanes fly, Cars drive, and Rowboats are rowed. Which of the four approaches are taken:
>
>1) The Vehicle superclass has Fly,Drive,and Row methods. The implementation of these methods is at either superclass or class level.
>
>2) The Vehicle supports a Move method. The subclass defines Move as appropriate and returns a value indicating it flew,drove, or was rowed.
>
>3) The subclasses have Fly, Drive, and Row methods as apppropriate; no Move or move specific methods are defined in the Vehicle superclass.
>
>4) We have *no* Vehicle superclass and each subclass of Airplane, Rowboat, and Car is it's own superclass.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform