Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Does vfp support polymorphism?
Message
 
To
20/06/2003 16:55:13
Gerry Schmitz
GHS Automation Inc.
Calgary, Alberta, Canada
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00802118
Message ID:
00802462
Views:
22
I once had a book "Delphi Unleashed" (I think) about 7 years old now I would guess (I lost it during moves). Anway, that book had the best example of Polymorphism I ever read. If anyone has it, check it and maybe post a brief of the example?

Cris

>Polymorphism:
>
>"Generally, the ability to appear in many forms. In object-oriented programming, polymorphism refers to a programming language's ability to process objects differently depending on their data type or class. More specifically, it is the ability to redefine methods for derived classes."
>
>
>   o1 = CREATEOBJECT( "Duck" )
>   o2 = CREATEOBJECT( "Pig" )
>
>   o1.Speak()
>   o2.Speak()
>
>DEFINE CLASS Homer AS Custom
>PROC Speak
>   = MESSAGEBOX( "DOH!" )
>ENDDEFINE
>
>DEFINE CLASS Duck AS Homer
>PROC Speak
>   = MESSAGEBOX( "Quack!" )
>ENDDEFINE
>
>DEFINE CLASS Pig AS Homer
>PROC Speak
>   = MESSAGEBOX( "Oink!" )
>ENDDEFINE
>
Previous
Reply
Map
View

Click here to load this message in the networking platform