473,405 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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 1483
Plater
7,872 Expert 4TB
I believe the base values can only be accessed from withen the overridden section.
Sep 9 '08 #2

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

Similar topics

1
by: Bryan Ray | last post by:
I am trying to write an inheritance function, so I can call a base classes method that has been overridden in the derived class. I want to get rid of the ugly 'call()' syntax that would be used....
4
by: Sean Connery | last post by:
I have a Microsoft UI Process Application Block that is controlling child forms in an MDI parent container. The views node in the app.config file has been set to stayOpen=false. Because there...
4
by: Akhil | last post by:
Hi All, Can u please explain this. Base Obj = new Derived(); Can Obj access methods both of Base and Derived or what will be the behaviour? What will be the behaviour for Overridden...
7
by: Baski | last post by:
Base class: class AssetBase { string _clli; public string CLLI { get
3
by: martin | last post by:
Hi, If I have a base class, say called "MyBase" and a derived class called "Myderived" is it possible to get the name of the derived class from the base class fo example if I have a method in...
4
by: Ray Dukes | last post by:
What I am looking to do is map the implementation of interface properties and functions to an inherited method of the base class. Please see below. ...
10
by: Michael D. Ober | last post by:
I have a class: Private Class ClientList Inherits StringCollection Public InternalUser As Boolean = False Public Shadows Function Contains(ByVal ClientNumber As String) As Boolean
7
by: MarkJ | last post by:
him im kinda new to c-sharp... to reference up the class chain, how do i reference the super class (parent) example class mybase { protected int abc=0 } classs myclass:mybase {
12
by: Robert Fuchs | last post by:
Hello, This example: public class BaseC { public int x; public void Invoke() {} } public class DerivedC : BaseC
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.