
17 Classes
17.10 Instance constructors
17.10.1 Constructor initializers
Paragraph 11 All instance constructors (except those for class object) implicitly include an invocation of another instance constructor immediately before the constructor-body. 2 The constructor to implicitly invoke is determined by the constructor-initializer:
C(...) {...}
is exactly equivalent to
C(...): base() {...}
end note]
Paragraph 31 The scope of the parameters given by the formal-parameter-list of an instance constructor declaration includes the constructor initializer of that declaration. 2 Thus, a constructor initializer is permitted to access the parameters of the constructor. [Example: For example:
class A
{
public A(int x, int y) {}
}
class B: A
{
public B(int x, int y): base(x + y, x - y) {}
}
end example]
Paragraph 41 An instance constructor initializer cannot access the instance being created. 2 Therefore it is a compile-time error to reference this in an argument expression of the constructor initializer, as it is a compile-time error for an argument expression to reference any instance member through a simple-name.
| |
| Jagger Software Ltd | |
| Company # 4070126 | |
| VAT # 762 5213 42 |