Mention the ways in which parameterized can be invoked. Give an example of each.
Answer / Lalit Kumar Saini
Parameterized functions or classes can be invoked in C++ in three ways: 1) Default Argument: When no argument is provided for a parameter that has a default value. Example: void greet(string name = 'World') { cout << 'Hello, ' << name << 'n'; } 2) Directly Providing Arguments: When specific arguments are provided to the function or class constructor. Example: vector<int> v(5); 3) Using Initializer Lists: When an initializer list is used to initialize a container. Example: vector<int> v = {1, 2, 3, 4, 5};
| Is This Answer Correct ? | 0 Yes | 0 No |
Can you overload the operator+ for short integers?
Is java based off c++?
What is rtti in c++?
Difference between overloading vs. Overriding
What is volatile and pragma? When they are used?
What are vtable and vptr?
How do you decide which integer type to use?
Explain virtual class?
What is the main use of c++?
What is the identity function in c++? How is it useful?
What is a rooted hierarchy?
give me an example for testing a program showing the test path .show how the test is important and complex.