Please use c++ to solve. Thank you so much! Warm-up Complete the following paper
ID: 3934799 • Letter: P
Question
Please use c++ to solve. Thank you so much!
Warm-up Complete the following paper/pencil exercises and discuss your results with one of your TAs: 1) Consider the following class declaration: class Point {public: void showPoint() const; Point(); Point(int, int); int xlocation; int ylocation;} ; What does the const keyword signify in line 3? Which line contains the default constructor for the class? The data members are declared public. Will this work? Would this be a good idea or not for a large program? Write the function definition for the constructor declared in line 5Explanation / Answer
a) const keyword signifies that the function can only change the class members which are mutable. non mutable members cannot be changed in this function.
b) line 4 contains the default constructor.
c) Yes, it will work fine.
d) If data encapsulation is not required for the program than it does not matter whether class members are declared public or private and whether it is small or large program.
e)
Point::Point(int x,int y)
{
xlocation = x;
ylocation = y;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.