General information
Category:
Object Oriented Programming
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
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only