Information générale
Catégorie:
Programmation Orientée Object
I understand you redefine the Display method in the form. In this case, protected properties are not visible.
Protected prop/methods are visible from the class where they are defined and from derived classes. When you redefine a method for an object in a form, the redefinition applies only to that instance of the class. This is not in the same class or in a derived class. IMO, this is the correct behavior (because this code is in fact in the Form).
Vlad
> I still abit confuse with it. Let's use an example:
>I have a timer class: mytimer
>method:
>Display
>?this.nhour
>?this.nmin
>?this.nses
>
>property:
>nhour (protected)
>nmin (protected)
>nsec (protected)
>
>I have added mytimer class into myform and inherint the display method with the following code.
>Inherintance method:
>Display
>?"Hour:" + str(this.nhour)
>?"minute:" + str(this.nmin)
>?"second:" + str(this.nsec)
>
>But i have an error message when run-time: Property nhour is not found
>
>Why?
>
>Thank you
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement