C# FAQ: What is the difference between CSharp and Java constructor chaining

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
CSharp-Online.NET:FAQs
edit

What is the difference between C# and Java constructor chaining?

Both C# and Java systems call base class constructors automatically. Further, they both provide ways for calling base class constructors with parameters. Also, both ensure that a base class constructor call will occur prior to any initializations performed in a subclass constructor. This precludes the possibility of a derived constructor using uninitialized members.

The C# syntax for base class constructor calling is similar to C++ initializer list syntax.

See also


Personal tools