<<< Week 5, Chapter 3, Advanced Concepts: Constructors, Overloading, Exceptions | Index | When is constructor called ? >>> |
Constructors are special operations that help to create and initialize objects.
Constructors are similar to
methods in Java
member functions in C++.
Compilers recognize that an operation is a constructor by looking at the name:
If name is the same as the class name, then this is a constructor.
A significant difference between constructors and other operations is that constructors don't have a return value.
<<< Week 5, Chapter 3, Advanced Concepts: Constructors, Overloading, Exceptions | Index | When is constructor called ? >>> |