Now consider the following code segment, assuming the Point class definition fro
ID: 3808467 • Letter: N
Question
Now consider the following code segment, assuming the Point class definition from Warm-up 1, and answer the questions below. int main() {Point.xlocation = 3; Point.ylocation = 10; Point p1; p1 = Point(5, 6); Point p2() ; return 0;} 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:Explanation / Answer
HI friend, You have not posted Point class, so it is difficult to answer all answer.
Although i have answered by assuming that Point class has public members.
Q1. No, since xlocation and ylocation are public, they are accessible directly.
Q2. we are creating a Point object with value 5,6
Here constructor with two parameter will be called
Q3.
Point p2();
Since we do not have default constructor (constructor without parameter),so it will throw error
Q4.
It create a Point object p2
Q5.
Point p2;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.