Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Does vfp support polymorphism?
Message
 
To
20/06/2003 19:21:54
Gerry Schmitz
GHS Automation Inc.
Calgary, Alberta, Canada
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00802118
Message ID:
00802981
Views:
26
>IMO, polymorphism becomes particularly useful when passing objects to general routines and you want to perform an operation on that object and do not know (or care) what kind of an object it is ... you just want to operate on it in a consistent manner (ie. using a common method name) and have it respond appropriately.
>

Yes, this is the essense of polymorphism. You cast the specialized instance to the more general instance and program against the interface of the general type. Polymorphism will make sure that the specialized behavior gets executed.

You do care what type it is. It must be a superclass of the specialized type (or implement an interface) otherwise you will get a runtime error in vfp (or a compile time error in a strongly typed language).
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform