Question

In: Computer Science

what is a const in C++? what does const mean in these functions

what is a const in C++?

what does const mean in these functions

-> " void idkwhattonameit( const name) {} "

-> " void idkwhattonameit2( const &name) {} "

-> " void idkwhattonameit3( const * name) {} "

-> " void idkagain (const unique_ptr < Name > name_uPtr)"


Solutions

Expert Solution

void idkwhattonameit( const name) {}

const name means the name parameter is used only for read only purpose.. we can't modify the name value but it will be no use if we use it on call by value

void idkwhattonameit2( const &name) {}

const name means the name parameter is used only for read only purpose.. we can't modify the name value but we can use it

void idkwhattonameit3( const * name)

here we made pointer as const than we can't change the address of variable name


Related Solutions

Is it fine to enter double before const in c++? Just like this double const ...
Is it fine to enter double before const in c++? Just like this double const ...
What does break and continue mean in C++?
What does break and continue mean in C++?
What does this and *this mean in c++ And how to use them
What does this and *this mean in c++ And how to use them
What does the term performance mean? Expected performance? b. What does the term risk mean? c....
What does the term performance mean? Expected performance? b. What does the term risk mean? c. Can the risk be completely eliminated? Why? d. In the financial securities market, how can the level of risk be minimized? and. What does variability mean within corporate finance? F. What does the concept of diversification mean within corporate finance? What is its application within a global stock market?
What does it mean when we say that money functions as a medium of exchange, as...
What does it mean when we say that money functions as a medium of exchange, as a store of value, and as a unit of account?
C++ programming question class Address { public: Address(const std::string& street, const std::string& city, const std::string& state,...
C++ programming question class Address { public: Address(const std::string& street, const std::string& city, const std::string& state, const std::string& zip) : StreetNumber(street), CityName(city), StateName(state), ZipCode(zip) {} std::string GetStreetNumber() const { return StreetNumber; } void SetStreetNumber(const std::string& street) { StreetNumber = street; } std::string GetCity() const { return CityName; } void SetCity(const std::string& city) { CityName = city; } std::string GetState() const { return StateName; } void SetState(const std::string& state) { StateName = state; } std::string GetZipCode() const { return ZipCode; }...
what does this "->" mean in c? when can you use it?
what does this "->" mean in c? when can you use it?
What does the term piecewise mean when referring to linear functions? Is a piecewise function always...
What does the term piecewise mean when referring to linear functions? Is a piecewise function always continuous across its entire domain? Explain your answer and give an example. Give an example of a piecewise function using functional notation and state its domain
For each of the following functions, does a constant c > 0 exist such that the...
For each of the following functions, does a constant c > 0 exist such that the function is a joint probability density function? If yes, what is c? If not, why not? Part (a) gives 2 points, parts (b)–(d) give each one point. (a) f(x, y) = ( cxye −x−2y if x ≥ 0 and y ≥ 0, 0 otherwise. (b) f(x, y) = ( cxye −x−2y if x ≥ −1 and y ≥ 1, 0 otherwise. (c) f(x, y)...
What does it mean to have a good life? What does it mean to be a...
What does it mean to have a good life? What does it mean to be a good person?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT