What is meant with const at end of function declaration

0 votes

I received a book in which it is written:

class Foo 
{
public:
    int Bar(int random_arg) const
    {
        // code
    }
};

What does it mean?

Jul 28, 2022 in C++ by Nicholas
• 7,760 points
456 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In C++

0 votes
0 answers

What is the point of function pointers?

The purpose of function pointers is difficult ...READ MORE

Aug 17, 2022 in C++ by Nicholas
• 7,760 points
384 views
0 votes
0 answers

What is the C++ function to raise a number to a power?

What's the best way to raise a n ...READ MORE

Jun 1, 2022 in C++ by Nicholas
• 7,760 points
518 views
0 votes
1 answer

What is the name of the "<<" and ">>" operators? [duplicate]

According to cplusplus.com's documentation: This operator (<<) applied to ...READ MORE

answered Jun 20, 2022 in C++ by Damon
• 4,960 points
390 views
0 votes
0 answers

What is the easiest way to initialize a std::vector with hardcoded elements?

I can make an array and initialise&nb ...READ MORE

Jun 27, 2022 in C++ by Nicholas
• 7,760 points
589 views
0 votes
0 answers

What is the meaning of "generic programming" in c++?

What does generic programming in C++ mean? I'm ...READ MORE

Jul 11, 2022 in C++ by Nicholas
• 7,760 points
628 views
0 votes
0 answers

What is the difference between cout, cerr, clog of iostream header in c++? When to use which one?

I looked up the differences between cout, ...READ MORE

Jul 27, 2022 in C++ by Nicholas
• 7,760 points
718 views
0 votes
0 answers

const int *p vs. int const *p - Is const after the type acceptable?

My coworker is 0 for 2 on questions inspired by him (1, 2), so I decided to give him a chance to catch up. Our most recent argument is about the placement of "const" on declarations. He believes it should be placed either in front of the type or after the pointer.  The explanation is that this is what everyone else does, and different styles are likely to be confusing.  Thus, a constant pointer to int and a constant pointer to int would be: const int *i; ...READ MORE

Jul 22, 2022 in C++ by Nicholas
• 7,760 points
550 views
0 votes
1 answer

What's the difference between constexpr and const?

Variables are protected from modification in your ...READ MORE

answered Aug 5, 2022 in C++ by Damon
• 4,960 points
1,334 views
0 votes
1 answer

How to implement constants in java

Here is the solution- public static final TYPE ...READ MORE

answered May 28, 2018 in Java by sophia
• 1,400 points
660 views
0 votes
1 answer

setuptools: build shared libary from C++ code, then build Cython wrapper linked to shared libary

There is a seemingly undocumented feature of setup that ...READ MORE

answered Sep 11, 2018 in Python by Priyaj
• 58,020 points
686 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP