Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dummy question about inheritance
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Title:
Dummy question about inheritance
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01125440
Message ID:
01125440
Views:
68
I have the following classes:
DEFINE CLASS myParent as Custom 
	myNumber = 1234
ENDDEFINE
and this one
DEFINE CLASS myChild as myParent OF myparent.prg
   *-- no action needed	
ENDDEFINE
Y and a test program
*-- testInheritance.prg
o1 = NEWOBJECT("myParent","myparent.prg")
? o1.myNumber
o1.myNumber = 5678
? o1.myNumber
o2 = NEWOBJECT("myChild","mychild.prg")
? o2.myNumber

o1 = null
o2 = null
Now, the question:
Why does o2.myNumber return 1234 instead of returning 5678 ?
what am I doing wrong in this example of inheritance?
I need the o2.myNumber "takes" 5678 value.

T.I.A.
Next
Reply
Map
View

Click here to load this message in the networking platform