Technical Discussion :: C++
Home > Technical Interview Q&A > C++ > Discussion
90 / 187
How to pass values as arguments to the constructor when an object is declared?
Answer:
To pass values as arguments to the constructor function when an object is declared. This done in two ways.
1. By calling the constructor explicitly.
2. By calling the constructor implicitly.
Eg :
Explicit call:
Integer int1=integer(0,200);
Implicit call:
Integer int1(0,100);
Asked In ::
Anuradha Singh
23 Feb, 2019 5:07 AM
To pass values as arguments to the constructor function when an object is declared. This done in two ways.
1. By calling the constructor explicitly.
2. By calling the constructor implicitly.
Eg :
Explicit call:
Integer int1=integer(0,200);
Implicit call:
Integer int1(0,100);
1. By calling the constructor explicitly.
2. By calling the constructor implicitly.
Eg :
Explicit call:
Integer int1=integer(0,200);
Implicit call:
Integer int1(0,100);