Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Property Read-Only.
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Titre:
Property Read-Only.
Divers
Thread ID:
00865736
Message ID:
00865736
Vues:
57
Hello!

How could I define some read-only properties in my classes? Example:
oApp = CreateObject("MyApp","BlaBla")
? oApp.Folder               && Ok, I get the value of this property.
oApp.Folder = "C:\TEST"     && No!!!!! I have to intercept it.

Define Class MyApp As Session
   Hidden Password
   Folder = CurDir()
   Password = "BlaBla"
   Function Init(m.tcPassword As String)
      This.Password = FileToStr(This.Folder+"UserPass.Txt")
      If m.tcPassword # This.Password
          Return .F.
      EndIf
   EndFunc
EndDefine
I don't know, the only way I wondered about it is:
oApp = CreateObject("MyApp","BlaBla")
? oApp.GetFolder()

Define Class MyApp As Session
   Hidden Password, Folder
   Folder = CurDir()
   Password = "BlaBla"
   Function Init(m.tcPassword As String)
      This.Password = FileToStr(This.Folder+"UserPass.Txt")
      If m.tcPassword # This.Password
          Return .F.
      EndIf
   EndFunc
   Function GetFolder()
      Return This.Folder
   EndFunc
EndDefine
Are there many options?

TIA
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Rodolfo Duarte
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform