Content deleted Content added
Constructors that can take at least one argument are termed as parameterized constructors. When an object is declared in a parameterized constructor, |
→Parameterized constructors: remove repetition |
||
Line 11:
=== Parameterized constructors ===
Constructors that can take at least one argument are termed as parameterized constructors. When an object is declared in a parameterized constructor, the initial values have to be passed as arguments to the constructor function. The normal way of object declaration may not work. The constructors can be called explicitly or implicitly. The method of calling the constructor implicitly is also called the shorthand method.
<syntaxhighlight lang="cpp">
|