Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to create an object in a class
Message
 
To
31/01/2006 18:15:40
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01092108
Message ID:
01092524
Views:
17
Fabio,

Thanks for the help. It works as you have stated, but I haven't been clear in my message. What I want to do is to pass the time object(after it has been created) as a parameter to the person object. Something like this
oPerson = createobject("Person")
oTime = createobject("Time")
oPerson.Init(oTime)
oPerson.GetAge()
I don't know if this is possible with addobject
>>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?
Zakaria al Azhar
My blog on Actuaris.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform