Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why '::'?
Message
De
26/04/2000 05:29:34
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00363407
Message ID:
00363491
Vues:
17
Larry,

>>>>Hi
>>>>
>>>>I just wanted to know why place like West Wind and Flash
>>>>use the following;
>>>>
>>>>OBJECT::Method it indicate a method and not
>>>>OBJECT.Method?
>>>>
>>>>TIA
>>>>
>>>>Mal
>>>
>>>Mal,
>>>
>>>It is actually CLASS::Method that is being used. That is the scope resolution opreator which is used to refer to a method in a specific class. It should be used when creating code in a sbuclass and you desire to call the code in the superclass.
>>
>>I consider the use of "::" as the equivalent of a GOTO command - a sign of a questionable design. Are there any circumstances where it legitimately needs to be used?
>
>How do you consider this a GOTO? GOTO (if I remember correctly) go to some specified label which may have nothing to do with the code currently running.

Right. Essentially GOTO allowed programmers to arbitrarily avoid whatever programming logic they were currently using but everything was always in the same code. On occassion I suppose this is necessary, but I can not think of a single instance where good programming practices could not fix this. Remember, GOTO came from Basic which was a Top-Down language.

Well written code can use GOTOs to simulate functions and Method calls but it has to be very well thought out.

Just guessing but I'd bet in this case this may be habit or a desire to absolutely go to the top level code.

>
>The scope resolution operator is used to issue call backs up the hierarchy chain. The most common usage as others have said is to make a call back to the parent class method. But I have used it in composite classes to bypass code in the parent class and run the code in the grandparent class and above. I think this is totally legitimate.
>
>Just my $0.02.

Best,

DD
Best,


DD

A man is no fool who gives up that which he cannot keep for that which he cannot lose.
Everything I don't understand must be easy!
The difficulty of any task is measured by the capacity of the agent performing the work.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform