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 8620865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:41:02+00:00 2026-06-12T06:41:02+00:00

This is a very simple C++ question but i can not get this. I

  • 0

This is a very simple C++ question but i can not get this.
I was doing a work and question came that create a simple calculator class which performs different operations. I have done this easily through methods but it says more that

“Every operation performed by the calculator object must be stored in
the object’s memory, which can be get or set by the user further.”

As a hint the book have given two methods

voidSetMem(double d);
double GetMem();

I can not understand what does this line means.

  • 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-06-12T06:41:03+00:00Added an answer on June 12, 2026 at 6:41 am

    Undertanding Getter / Setter Methods

    Basically a ‘Getter’ is a function that returns the data stored in some variable, in you’re text book hint

    double getMem()
    {
    //Return your data
    return memoryVariable;
    }
    

    And your ‘Setter’ would be a function used to set some variable

    void setMem (double variableToPass)
    {
    memoryVariable = variableToPass
    }
    

    Notice two things:
    1.) The getter function returns a data type double (because you are asking the program to provide you with data already set/stored
    2.) The setter function returns NO data type (because you are telling/setting some variable)

    Here is a basic example to GET the area from a square:

    double getArea()
    {
       return pow(side, 2);
    }
    

    Now in your program you would obtain this data like so:

    cout << " The area of the circle is " << sq1.getArea() <<"\n";
    

    Here is a basic example to SET the area from a square:

     void setSide(double newSide)
    {
        side = newSide;
    }
    

    And in your program you would set this data like so:

     sq1.setSide(50);
    

    Hope This answers your question. Good Luck

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a very simple question, but I can't seem to find something about
This is probably a very simple question so please forgive my ignorance, but can
I'm sure this is a very simple question, but embarrassed to say I can't
This is a very simple question for compiler guys, but I always get confused
This seems to me like a very simple question, but I can't seem to
Very simple question but I'm quite new to JS and this is not easy
this might be a very simple question, but I could not find an answer
I feel that this is a very simple question, but I'm new to Python,
This may be very simple question,But please help me. i wanted to know what
This is probably a very simple question but I'm a little confused how this

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.