Re: Calling the base class constructor
From: cody (no_spam_deutronium_at_gmx.net)
Date: 05/26/04
- Next message: Ed Courtenay: "Re: trying to create a c# version of bindshell.c"
- Previous message: cody: "Re: Executing scripts using C#"
- In reply to: Jon Skeet [C# MVP]: "Re: Calling the base class constructor"
- Next in thread: Jon Skeet [C# MVP]: "Re: Calling the base class constructor"
- Reply: Jon Skeet [C# MVP]: "Re: Calling the base class constructor"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 26 May 2004 15:15:58 +0200
> > I was wondering how I could call the base class constructor from a
derived
> > class constructor. In Java I could do something like
> >
> > super(parameter);
> >
> > I tried
> >
> > base(parameter);
> >
> > in C# but it doesn't compile. Any ideas?
>
> You do base (parameter) but in a different place:
>
> public Derived() : base (...)
> {
> }
>
> See http://www.pobox.com/~skeet/csharp/constructors.html for more
> information.
I've never understood why this special syntax is used here. Why not do it
like java and allow base(param);?
This would give you the freedom to do parameter processing before calling
the base ctor or you could do a try{}catch around the base()-call in future
versions of c#.
-- cody Freeware Tools, Games and Humour http://www.deutronium.de.vu || http://www.deutronium.tk
- Next message: Ed Courtenay: "Re: trying to create a c# version of bindshell.c"
- Previous message: cody: "Re: Executing scripts using C#"
- In reply to: Jon Skeet [C# MVP]: "Re: Calling the base class constructor"
- Next in thread: Jon Skeet [C# MVP]: "Re: Calling the base class constructor"
- Reply: Jon Skeet [C# MVP]: "Re: Calling the base class constructor"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|