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

Ancestor Constructor's

The following statement appears in the Help under the heading Using
Constructors And Destructors:

"When you define a class derived from another class, the first line of a
constructor must be a call to the constructor of the base class, unless the
base class has an accessible constructor that takes no parameters. A call to
the base class containing the above constructor, for example, would be
MyBase.New(s). Otherwise, MyBase.New is optional, and the Visual Basic .NET
runtime calls it implicitly."

Based on that statement, my understanding is that when a class gets created,
the first thing that happens is that the classes' ancestor constructor gets
executed. Is it possible to have code in the derived class constructor that
executes before the code in the ancestor class does?

Nov 21 '05 #1
4 1201
"Alex" <pl*****@no.mail> schrieb:
Based on that statement, my understanding is that when a class gets
created,
the first thing that happens is that the classes' ancestor constructor
gets
executed. Is it possible to have code in the derived class constructor
that
executes before the code in the ancestor class does?


No.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
It seems to me, that if you need to do this something is wrong with your
class structure. Example?

"Alex" <pl*****@no.mail> wrote in message
news:uE**************@tk2msftngp13.phx.gbl...
The following statement appears in the Help under the heading Using
Constructors And Destructors:

"When you define a class derived from another class, the first line of a
constructor must be a call to the constructor of the base class, unless
the
base class has an accessible constructor that takes no parameters. A call
to
the base class containing the above constructor, for example, would be
MyBase.New(s). Otherwise, MyBase.New is optional, and the Visual Basic
.NET
runtime calls it implicitly."

Based on that statement, my understanding is that when a class gets
created,
the first thing that happens is that the classes' ancestor constructor
gets
executed. Is it possible to have code in the derived class constructor
that
executes before the code in the ancestor class does?

Nov 21 '05 #3
"Robin Tucker" <id*************************@reallyidont.com> wrote in message
news:d6*******************@news.demon.co.uk...
It seems to me, that if you need to do this something is wrong with your
class structure. Example?


I grant you that it doesn't make for a clean design, but when inheriting one
doesn't always have control over what happens in the ancestor classes. An
example would be if you want to save state before the code in the ancestor's
constructor gets executed.
Nov 21 '05 #4
Thanks.
Nov 21 '05 #5

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

Similar topics

3
by: Mike Partridge | last post by:
Is it possible to access your caller's (not parent) context while inside a <xsl:template match...> or <xsl:for-each...>? Here is the xml I'm using: <report-set> ...<report> .....<detail-data>...
2
by: Jesper | last post by:
Hi, Is it possible to query an object for an ancestor. I.e. determine if an object is derived from a certain type of class. thanx. Jespr.
3
by: Jack Addington | last post by:
Is there a quick and easy way in Visual Studio 2003 to get the method declaration from the ancestor so I can override/extend it? I know that if I am in another method or the constructor and type...
3
by: Dan Holmes | last post by:
If i have Class2 that is inherited by Class1, how can Class1's methods operate on Class2's assembly information? For instance: public class Component { public virtual List<ComponentInfo>...
11
by: John Bailo | last post by:
Is anyone familar with the correct syntax for using ancestor:: ? I am trying to use it in a c# application, and I am also testing it in a parser application called Cooktop (...
2
by: werD | last post by:
Hello, Im wondering about using xml to store relational data. It works well with .net but im having some trouble with the xsl/xpath. Lets say that I have an xml like <data> <files> <file...
3
by: Luis P. Mendes | last post by:
Hi, I have the following problem: I instantiate class Sistema from another class. The result is the same if I import it to interactive shell. s = Sistema("par") class Sistema:
3
by: Valvalis | last post by:
Hello, I am trying to set a class attribute of a text.item element to the value of its nearest ancestor. I want to do this in the case that the class of the text.item is currently a blank string....
7
by: Ebenezer | last post by:
Hello! Let's suppose we have an XML with some nested NODE nodes: <root attr="first"> <node id="1" attr="mike"> <node id="2" /> <node id="3" attr="dave" /> </node> <node id="4">
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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.