Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to determine, if a method has some Code?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00793398
Message ID:
00794541
Vues:
11
Bhavbhuti,

So you are creating an abstract class, ie defining an abstract method name to put it into the interface, and may in fact have other code in the class that makes calls to that method, but you require that a concrete subclass provide the implementation of the method.

create classlib abstract1
create class test of abstract1 as custom

I created a method, MyMethod, set the comment to "MyMethod - abstract method must be implemented by the subclass", and I left the method empty. There is in fact no reason to put a dodefault() in there because there is nothing to call, there is no inherited code.

I set the Init() method to:
if ( ! pemstatus( this, "MyMethod", 0 ) )
   debugout "abstract method not supplied, object not instantiating"
   return .f.
else
   debugout "abstract method supplied all is cool"
endif
create class subtest of abstract1 as test from abstract1

* and simply closed the class desinger with saving, ie I have not provided implementation for the abstract method

set classlib to abstract1
activate window "debug output"
ox = createobject( "subtest" )
? type( "ox" ) && L it did not instantiate

create class goodsubtest of abstract1 as test from abstract1

I put some code into the MyMethod method.

ox = createobject( "goodsubtest" )
? type( "ox" ) && O it does instantiate




>I have my-combo-class which has a method ReplaceID() just added to it. When I use this class in a form, it has to be populated, prefrably with a dodefault() so I can in future add codes to it in my-combo-class)
>
>What code can I put in my-combo-class.replaceid() to warn me prefrably when I start the form that replaceid() for the combo on the form has not been populated?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform