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
| CSharp-Online.NET:FAQs |
| edit |
[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.
[edit]
See also
- C# for Java Developers
- What is the difference between C# and Java constructor chaining?
- What is the difference between calling base class constructors in C# and Java?
- Are C# constructors inherited?
- How can one constructor call another?
- Are constructors the same in C++ and C#?
- Are destructors the same in C++ and C#?
- How call a virtual method from a constructor or destructor?
- How do destructors work in C#?
- How enforce constructor correctness in C#?
- How make a C# destructor virtual?
- What are the differences between C# and Java constructors?
- What are the differences between C# finalizers and Java destructors?
- What is the syntax for calling an overloaded constructor from within a constructor?
- Why must
structconstructors have at least one argument?