473,400 Members | 2,145 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,400 software developers and data experts.

Base class

I've a very simple question:-

if I run any method in the Mybase class, what exactly it will run
against?
e.g.
Let's say i have in my project a form (form1)
when i add such lines of code:
mybase.hide
mybase.height = 100
it runs against form1 (form1 is hided, form1 height changes)
but isn't mybase a base class which is shadowed or overriden by a
derived class?
Isn't this like referrring to a form.hide, or textbox.clear
which form and which text box??
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 20 '05 #1
1 1070
> if I run any method in the Mybase class, what exactly it will run
against?
e.g.
Let's say i have in my project a form (form1)
when i add such lines of code:
mybase.hide
mybase.height = 100
it runs against form1 (form1 is hided, form1 height changes)
but isn't mybase a base class which is shadowed or overriden by a
derived class?
No it actually runs against the base form. Form1 is decended from
System.Windows.Forms.Form or whatever the path is, so the code above
to hide and alter the dimensions is actually running against that.

Nothing is shadowed or overriden unless you explicitly do so. For
instance if you declare another property in Form1

Public Shadows Property Height etc.

Then your code above will call the property in form1 and you will have
to explicity call the height property in the base form

mybase.height = x

if you want to alter this property.

Dont ask ME to explain shadowing though.
I clench my buttocks every time i think about it.

It is straight forward for most but it ties my brain in knots for some
reason when you start getting into multi level inheritence, etc....
uugh I hate it. Although i understand it, i cant explain it, which is
kinda contridictory i know ....
Isn't this like referrring to a form.hide, or textbox.clear
which form and which text box??


Yeah thats what im talking about. It depends entirely on the
inheritence tree, what in the base class(es) has been shadowed and
overriden etc.

Theres a section in the docs, I think its the vb language guide
section 4.3.3 that talk's about it, quite nice with ex code. I had to
read that section about 5 times before i got it - dunno why?

hth
Richard
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Gabriel Genellina | last post by:
Hi In the following code sample, I have: - a Worker class, which could have a lot of methods and attributes. In particular, it has a 'bar' attribute. This class can be modified as needed. - a...
8
by: Bryan Parkoff | last post by:
I find an interesting issue that one base class has only one copy for each derived class. It looks like that one base class will be copied into three base classes while derived class from base...
7
by: Baski | last post by:
Base class: class AssetBase { string _clli; public string CLLI { get
5
by: Andy | last post by:
Hi all, I have a site with the following architecture: Common.Web.dll - Contains a CommonPageBase class which inherits System.Web.UI.Page myadd.dll - Contains PageBase which inherits...
7
by: relient | last post by:
Question: Why can't you access a private inherited field from a base class in a derived class? I have a *theory* of how this works, of which, I'm not completely sure of but makes logical sense to...
6
by: Taran | last post by:
Hi All, I tried something with the C++ I know and some things just seem strange. consider: #include <iostream> using namespace std;
5
by: Dennis Jones | last post by:
Hello, I have a couple of classes that look something like this: class RecordBase { }; class RecordDerived : public RecordBase {
26
by: nyathancha | last post by:
Hi, How Do I create an instance of a derived class from an instance of a base class, essentially wrapping up an existing base class with some additional functionality. The reason I need this is...
2
by: cmonthenet | last post by:
Hello, I searched for an answer to my question and found similar posts, but none that quite addressed the issue I am trying to resolve. Essentially, it seems like I need something like a virtual...
1
by: Rune Allnor | last post by:
Hi all. I am sure this is an oldie, but I can't find a useful suggestion on how to solve it. I have a class hierarchy of classes derived from a base class. I would like to set up a vector of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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
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.