Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Differences between :: and DoDefault()
Message
 
 
To
24/01/2002 08:56:02
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00609627
Message ID:
00609697
Views:
20
This message has been marked as a message which has helped to the initial question of the thread.
>>Hilmar,
>>
>>Thank you. I think DoDefault is better for me! :P
>>
>>[]s
>
>It is much better in most cases, for the very reason you mention: possible changes in method names.
>
>Also, DoDefault() has a simpler syntax.
>

Hilmar/Rodolfo,
Actually, if the method names are changed, it doesn't matter if you use :: or DODEFAULT(). You lose your subclassed code.

VFP stores method code in the Methods memo field in the VCX. When you change the parent class, no changes are done to the memo fields of the subclasses. You are orphaning that code. The only way to access it at that point is to open the VCX as a table and manually change the reference, close the VCX and compile the class library.

One should never change a method name once it is in use (e.g. already subclassed). This is changing the interface. If you do this, you are going to break everything and give yourself a lot of work making things right.

In response as to what way to use. It doesn't matter now. However, before VFP 6, DODEFAULT() was buggy and the scope resolution operator had to be used. If you come from a C/C++ or Java background, the scope resolution operator may be more familiar to you. It is by far more self-documenting. You know exactly what code is being called.

It's simply a matter of preference.

Regards.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform