Re: Novice question about inherited constructors
- From: "David" <Contributor@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 10 Apr 2006 16:27:20 -0400
Thank you. I am actually trying to figure out why a TreeView works when
nodes are constructed using the TreeNode class but do not work when using a
class derived from TreeNode.
What is the difference between
public class TreeNode
{
public TreeNode()
{
}
}
and
public class B : TreeNode
{
public B : base()
{}
}
?
Why does an index go out of range in LoadViewState with the later.
"Jon Skeet [C# MVP]" <skeet@xxxxxxxxx> wrote in message
news:MPG.1ea4babf6ad3731798d07e@xxxxxxxxxxxxxxxxxxxxxxx
David <Contributor@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
How is
public class A
{
public A(){}
}
different from
public class B : A
{
public B() : base()
{}
}
The first declares a type which derives from System.Object
(implicitly). The second declares a type which derives from A. Both
declare a public parameterless constructor which calls (implicitly in
the first case) the parameterless constructor in the base class.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.
- Follow-Ups:
- Re: Novice question about inherited constructors
- From: Jon Skeet [C# MVP]
- Re: Novice question about inherited constructors
- References:
- Novice question about inherited constructors
- From: Oleg Subachev
- Re: Novice question about inherited constructors
- From: Jon Skeet [C# MVP]
- Re: Novice question about inherited constructors
- From: David
- Re: Novice question about inherited constructors
- From: Jon Skeet [C# MVP]
- Novice question about inherited constructors
- Prev by Date: Re: Property or Function?
- Next by Date: Re: console.writeline overload question
- Previous by thread: Re: Novice question about inherited constructors
- Next by thread: Re: Novice question about inherited constructors
- Index(es):
Relevant Pages
|