Called 'constructor initializers' in C#, the two keywords this (similar to Java's this ) and base (similar to Java's super ) allow the programmer to invoke an overloaded constructor in the same class and a constructor in the superclass, respectively. Like Java
Output: c:\expt>test GrandParent Parent Child with 1 param Unlike JavaThe differences between Java's this() and super() compared to C#'s this() and base() are largely syntactical when used in constructors. In Java, you can only use this() and super() as a statement in the first line of the constructor, if they are used. In C#, the keywords are extensions of the constructor's method declaration. |