Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Thoughts on Interface Inheritance
Message
 
To
24/08/2000 11:46:12
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00408807
Message ID:
00408893
Views:
12
>4- tech question - the article uses a VB example along the lines of:
Dim Dog1 as IDog <br>Set Dog1 = New CBeagle
What is the eqivalant VFP code to instantiate an object in this way - or does VFP not play on that side of the equatin either at this time?

Hi Ken,

I'll give it a shot. I'm not a VB expert but.
Dim Dog1 as IDog

This just creates a new var of type IDog. AFAIK, there isn't an equivalent in VFP other than local IDOG which doen't really do what VB does. In VB using the Dim statement tells it the type and it looks up the PEMS for IDog. SWAG we'll probably see it in VFP 7 because that is what makes intellisense work.

Set Dog1 = New CBeagle

Dog1 = createobject("CBeagle") Just create the object.

Doesn't help you much though because the cool stuff happens in the class, not the implementation.

Think of it like this. Create a Class called IDog, with a method Bark. Don't put any code in the Bark method. This would be called an Abstract class. It is NEVER used to create an object, it only purpose is to define the interface for an on object of type DOG.

Now create a class called CBeagle. It already has a method called Bark, And you then just add code to the Bark method. This is the concrete class. It will be used to create an object. It will have all the PEMS of a dog, and could have it's own PEMS in addition as well.

At least that's how I understand it.
Roi
'MCP' Visual FoxPro

In Rome, there was a poem.
About a dog, who found two bone.
He lick the one, he lick the other.
He went pyscho, he drop dead!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform