Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 525285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:39:20+00:00 2026-05-13T08:39:20+00:00

in int salary() const { return mySalary; } as far as I understand const

  • 0

in

int salary() const { return mySalary; }

as far as I understand const is for this pointer, but I’m not sure. Can any one tell me what is the use of const over here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:39:20+00:00Added an answer on May 13, 2026 at 8:39 am

    Sounds like you’ve got the right idea, in C++ const on a method of an object means that the method cannot modify the object.

    For example, this would not be allowed:

    class Animal {
       int _state = 0;
    
       void changeState() const { 
         _state = 1;
       }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one table called EmployeeSalary with two columns EmpID(int) and Salary(decimal(15,2)) While selecting
I'm just wondering why CREATE TABLE employeeinfo( position CHAR(50), salary INT NOT NULL, branch
public class Job { public string Name { get; set; } public int Salary
int a[2]; This in memory actually looks like: //Assuming int is 2 bytes add=2000,
@Entity public class Person { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private Long id; private int salary; @Version
char name; char* id; int salary; char department[5]; How I want to append all
I have the following schema: Emp( eid int, ename varchar(50), salary float, email varchar(80))
I have the following struct: struct Records { int Number; char Name[20]; float Salary;
Any idea why the following code isn't working? My struct: struct Records { int
I want to return the depart number that is not found Employee Table by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.