Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Dummy question about inheritance
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Titre:
Dummy question about inheritance
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Divers
Thread ID:
01125440
Message ID:
01125440
Vues:
69
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform