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
in C++ Define a class bank account with proper constructors, accessors, mutators, and other member functions....
in C++ Define a class bank account with proper constructors, accessors, mutators, and other member functions. The class will be store money expressed in dollars and cents. The class should have following data members (fname, lname, accountNum, balance, dollars, cents).Write A function to print out the object bank account info.The class should implement two member functions for deposit and withdrawal. Overload the + operator, so that adding two objects of this class works. please respond quickly and clearly, thank you.
what output is produced by the following code and explain how it works. public class A...
what output is produced by the following code and explain how it works. public class A { int a = 1; int b = 2; public int getSum(int a, int b) {     this.a+=a;     this.b+=b;     return this.a + this.b; } } public class B extends A { int a = 3; int b = 4; public int getSum(int a, int b) {     this.b=a;     super.b=b+b;     return super.a+this.b; } } public class q2 { public static void...
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
C++: Develop a simple Tc-Tac-Toe game between a human and the computer. Place the Tac-Tac-Toe board...
C++: Develop a simple Tc-Tac-Toe game between a human and the computer. Place the Tac-Tac-Toe board in an array of char (e.g., char board[9] ) and use functions to create "operations" from which you can build a game (see class notes, for example: reset(), Go(), display(), etc.... avoid an over used of global variables, use constants instead of pure numbers or characters, provide comments for other programmers to see how your code works.
What is a diuretic and how briefly explain how it works?
What is a diuretic and how briefly explain how it works?
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT