Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to create an object in a class
Message
De
31/01/2006 18:15:40
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
01092108
Message ID:
01092116
Vues:
17
This message has been marked as a message which has helped to the initial question of the thread.
>Hi All,
>
>I want to create an object from an other in a class, but for some reason this isn't possible. I can only do this in a function of a class. For example:
>
>
>
>DEFINE CLASS Person as Custom
>
>cName = ""
>dBirthdate = {//}
>oTime = null
>nAge = 0

* because this load a object into the class property, not into the object
>oTime = createobject("zaTime") && not possible why????

* correct way
 ADD OBJECT oTime AS zaTime


>
>FUNCTION GetAge()
>
>RETURN  this.oTime.PointOfTime - this.dBirthDate
>
>ENDFUNC
>
>
>
>ENDDEFINE
>
>DEFINE CLASS zaTime as Custom
>
>m.PointOfTime = DATETIME()
>
>
>ENDDEFINE
>
>
>
>
>I was wondering why this can't be done? And what is the solution for this?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform