Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Public variables VS objects
Message
From
04/06/2003 20:42:18
 
 
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00795846
Message ID:
00796471
Views:
14
>Can someone tell me why this doesnt work?
>?oobj.empresa.nome

try changing the class to something like this:
Define Class Objeto As Session
    Licenciado = null
    Empresa = null
    Programa = null
    
    Function Init
	    this.Licenciado = CreateObject("Licenciado")
	    this.Empresa = CreateObject("Empresa")
	    this.Programa = CreateObject("Programa")
    EndFunc 
    
EndDefine
Actually, I'd even create an Access method for each property so that the internal objects instantiation would be delayed up to the moment when they're accessed for the first time. Something like:
Define Class Objeto As Session
    Licenciado = null
    Empresa = null
    Programa = null

     function Licenciado_Access

        if vartype(This.Licenciado) <> "O" or isnull(This.Licenciado)
           this.Licenciado = CreateObject("Licenciado")
        endif 

        return This.Licenciado
     endfunc 
enddefine 
HTH
Claudio Lassala
Previous
Reply
Map
View

Click here to load this message in the networking platform