469,921 Members | 2,093 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,921 developers. It's quick & easy.

Accessing the Base Class Instance of an Overridden Property

I am wondering if it is possible to access the underlying property of a base class within a derived that has overridden that property. I am using VB.NET and when I use the MyBase keyword to access the property of the base class, it accesses the overridden property instead.

Specifically, my class is inheriting the TextBox class and I am overriding the Text property to have it display something different based on the state of my class. I was hoping that when I use MyBase.Text within a private method in my class that it would bypass my overridden Text property and access the Text property of the base class directly, but it does not.

I know that I can shadow the property instead, but if I pass my class around as an instance of the base class elsewhere in my program, I donít want it to be accessing the base class property directly. Is there any way I can get around this problem?
Sep 9 '08 #1
1 1313
Plater
7,872 Expert 4TB
I believe the base values can only be accessed from withen the overridden section.
Sep 9 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Bryan Ray | last post: by
4 posts views Thread by Akhil | last post: by
3 posts views Thread by martin | last post: by
10 posts views Thread by Michael D. Ober | last post: by
7 posts views Thread by MarkJ | last post: by
reply views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.