The _______ keyword is used when we want to explicitly pass by reference but prevent the function from modifying the argument.
- const
- static
- virtual
- inline
The const keyword is used in C++ to indicate that a value shouldn't be modified. When passing an argument by reference, using const before the parameter type ensures that the function does not alter the original data, providing a level of safety.
Loading...
Related Quiz
- When dynamically allocating an array of integers using new, which of the following syntax is correct?
- You are designing a class that will be widely used across a large project. The class will often be copied and assigned to other instances. What considerations related to constructors and assignment operators should be taken into account to ensure efficient and correct operation?
- The _______ keyword is used to explicitly instantiate a template.
- The _______ function is used to move the file pointer to a specified position in the file.
- Which type of function cannot be virtual in C++?