Question

make simple class in c++.. to explain how accessor, mutators etc works

make simple class in c++..
to explain how accessor, mutators etc works

Homework Answers

Answer #1

Member functions that only access the data members are called accessors.

Similarly, member functions that modify the data members, called mutators.

Advantage--

We can make our data members private and use accessors and mutators to make changes in them.

Therefore, the data members will not be accessed directly by the object outside the class.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
public class Auto { private String make; private String model; private int year; } a) write...
public class Auto { private String make; private String model; private int year; } a) write a default constructor for the Auto Class n) Write a constructor to initialize all instance variables c) write accessor and mutator for make variable d) create an onject name it myAuto with values of Toyota, Camry, and 2016
1a)Explain how you would make the decision to take an honors class rather than a regular...
1a)Explain how you would make the decision to take an honors class rather than a regular class. Make sure to use the terms self-interest and benefits in your response. 1b) What costs are there when you take an honors class instead of a regular class?
[C++ Language] Describe how the following call by reference works. Make a comment for each line....
[C++ Language] Describe how the following call by reference works. Make a comment for each line. void pxc(int& c, int& d) {     int k = c;     c = d;     d = k; }    int main() {     int a = 15, b = 100;     pxc(a, b); }
Explain how Sanger sequencing works.
Explain how Sanger sequencing works.
Explain how blood typing works
Explain how blood typing works
Explain how an induction motor works
Explain how an induction motor works
What is a diuretic and how briefly explain how it works?
What is a diuretic and how briefly explain how it works?
In class, we learned about fermions, bosons, etc. Using these fundamental particles and relative ideas, explain...
In class, we learned about fermions, bosons, etc. Using these fundamental particles and relative ideas, explain why hydrogen atoms are stable if you take quantum effects into account.
Explain how the bridge-rectifier circuit works.
Explain how the bridge-rectifier circuit works.
explain how differential works and give example?  
explain how differential works and give example?