Genau Siehe auch C# Language Reference:
http://www.cs.auckland.ac.nz/~jas/old/clangref.html unter: 10.10.1 Constructor initializers <cut> All constructors (except for the constructors of class object) implicitly include an invocation of another constructor immediately before the first statement in the block of the constructor. The constructor to implicitly invoke is determined by the constructor-initializer: A constructor initializer of the form base(...) causes a constructor from the direct base class to be invoked. The constructor is selected using the overload resolution rules of �7.4.2. The set of candidate constructors consists of all accessible constructors declared in the direct base class. If the set of candidate constructors is empty, or if a single best constructor cannot be identified, an error occurs. A constructor initializer of the form this(...) causes a constructor from the class itself to be invoked. The constructor is selected using the overload resolution rules of �7.4.2. The set of candidate constructors consists of all accessible constructors declared in the class itself. If the set of candidate constructors is empty, or if a single best constructor cannot be identified, an error occurs. If a constructor declaration includes a constructor initializer that invokes the constructor itself, an error occurs. If a constructor has no constructor initializer, a constructor initializer of the form base() is implicitly provided. Thus, a constructor declaration of the form C(...) {...} is exactly equivalent to C(...): base() {...} The scope of the parameters given by the formal-parameter-list of a constructor declaration includes the constructor initializer of that declaration. Thus, a constructor initializer is permitted to access the parameters of the constructor. For example: class A { public A(int x, int y) {} } class B: A { public B(int x, int y): base(x + y, x - y) {} } A constructor initializer cannot access the instance being created. It is therefore an error to reference this in an argument expression of the constructor initializer, as is it an error for an argument expression to reference any instance member through a simple-name. </cut> -----Urspr�ngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Im Auftrag von Alexander Bohle Gesendet: Samstag, 30. M�rz 2002 19:16 An: aspDEdotnet Betreff: [aspdedotnet] AW: RE: base -> Constructor OK, wenn ich das richtig verstehe ruft 'public ChildClass(): base()' den Constructor von BaseClass auf. s.u.: class ChildClass : BaseClass { public ChildClass(): base() { } } Alex -----Urspr�ngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]Im Auftrag von Christoph R�egg Gesendet: Samstag, 30. M�rz 2002 19:02 An: aspDEdotnet Betreff: [aspdedotnet] RE: base -> Constructor Hallo Willst du den Constructor der Baseclass nur unter bestimmten Bedingungen ausf�hren, nicht immer? Sonst k�nntest du die ansonsten daf�r vorgesehene Syntax verwenden, die funktioniert sicher: Public DBHandler(typ1 param1, typ2 param2): base(param1,param2) { //... } hth Chris -----Urspr�ngliche Nachricht----- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Im Auftrag von Alexander Bohle Gesendet: Samstag, 30. M�rz 2002 17:17 An: aspDEdotnet Betreff: [aspdedotnet] base -> Constructor Hallo, ist ja doch jemand online! Ich m�chte gerne im Constructor meiner erbenden Klasse den Constructor der vererbenden Klasse Aufrufen. Habe aber irgentwie Probleme mit base.DBHandler(); Bekomme immer wieder diesen Compilierungsfehler: DataHandler.cs(55,4): error CS0117: 'DataHandler.DBHandler' does not contain a definition for 'DBHandler' Kann mir jemend sagen was ich falsch mache? Alex | [aspdedotnet] als [EMAIL PROTECTED] subscribed | http://www.dotnetgerman.com/archiv/aspdedotnet/ = Listenarchiv | Sie k�nnen sich unter folgender URL an- und abmelden: | http://www.dotnetgerman.com/listen/aspDEdotnet.asp | [aspdedotnet] als [EMAIL PROTECTED] subscribed | http://www.dotnetgerman.com/archiv/aspdedotnet/ = Listenarchiv | Sie k�nnen sich unter folgender URL an- und abmelden: | http://www.dotnetgerman.com/listen/aspDEdotnet.asp | [aspdedotnet] als [EMAIL PROTECTED] subscribed | http://www.dotnetgerman.com/archiv/aspdedotnet/ = Listenarchiv | Sie k�nnen sich unter folgender URL an- und abmelden: | http://www.dotnetgerman.com/listen/aspDEdotnet.asp | [aspdedotnet] als [email protected] subscribed | http://www.dotnetgerman.com/archiv/aspdedotnet/ = Listenarchiv | Sie k�nnen sich unter folgender URL an- und abmelden: | http://www.dotnetgerman.com/listen/aspDEdotnet.asp
