Question: Consider the following class declaration: 1 class Point 2 (public: 3 void show Point() const: 4 Point(); 5 Point(int, int) 6 int x location 7

Consider the following class declaration: 1 class Point 2 (public: 3 void show Point() const: 4 Point(); 5 Point(int, int) 6 int x location 7 int location; a. What does the const keyword signify in line 3? b. Which line contains the default constructor for the class? c. The data members are declared public. Will this work? d. Would this be a good idea or not for a large program? e. Write the function definition for the constructor declared in line 5 Now consider the following code segment, assuming the Point class definition from above, and answer the questions below. 1 int main() 2 { 3 Point x location = 3; 4 Pointy location = 10; 5 Point p1; 6 pl = Point(5,6): 7 Point p2(): 8 return 0: 9) a. Describe the problem (if any) with the statements in lines 3 and 4. b. Describe (in detail) what the statement in line 7 does (consult your textbook): c)What is the problem (if any) with the statement in line 9 (assuming you are trying to declare an instance of the point class? d. What does the statement in line 9 currently declare? e. Rewrite the statement in line 9 to declare a default instance of the Point class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
