Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hidden property exposed as public
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Miscellaneous
Thread ID:
01479474
Message ID:
01479480
Views:
69
Yes, this is a bug - VFP 9.0 SP 2 Build 7423
- hidden property
- derived class

No bug variants
a)
- hidden property
- defined class

- protected property
- defined/derived class

MartinaJ

>- Using VFP SP2 (.6303) -
>It appears that property defined as hidden in the superclass, will be exposed as public by an instance of a subclass, if the same property is assigned a value in the superclass.init, and the subclass.init invokes a DODEFAULT()
>Is this normal?
>*
>Here is the sample code (run it in a prg):
>
>LOCAL oX, iAx
>LOCAL ARRAY laM[1]
>*
>oX = CREATEOBJECT("xTestSub")
>*
>ACTIVATE SCREEN
>*
>? "--- Property h1 defined as Hidden in the superclass, however --- "
>IF AMEMBERS(laM, m.oX, 0, "G#") > 0
>   iAx = ASCAN(laM, "H1", 1, -1, 1, 14)
>   IF m.iAx > 0 AND "G" $ laM[m.iAx, 2]
>      ? "Subclass instance has property h1 exposed as public" FONT "Courier New", 10
>   ENDIF
>ENDIF
>* m.oX.h1 access should fail
>? "Should not be able to access h1", m.oX.h1 FONT "Courier New", 10 STYLE "BI"
>m.oX.h1 = "new value to h1"
>* m.oX.h1 assign should fail
>? "Furthermore, should not be able to assign", m.ox.h1 FONT "Courier New", 10 STYLE "BI"
>*
>?
>	
>*=====================================
>DEFINE CLASS xTestSub AS xTestBase
>*=====================================
>
>	*************************
>	FUNCTION Init
>	*************************
>	DODEFAULT()   && this seems to make it happen
>	RETURN .T.
>	
>	
>ENDDEFINE
>
>
>*=====================================
>DEFINE CLASS xTestBase AS Custom
>*=====================================
>	
>	HIDDEN h1
>	h1 = ""
>	
>	*************************
>	FUNCTION Init
>	*************************
>	This.h1 = "value from superclass.init"
>	RETURN .T.
>
>ENDDEFINE
>
>
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform