C++ Programming: 1) Consider the following class declaration: 1 class Point 2 { public: 3 void showP

C++ Programming:

1) Consider the following class declaration:

1  class Point

Save your time - order a paper!

Get your paper written from scratch within the tight deadline. Our service is a reliable solution to all your troubles. Place an order on any task and we will take care of it. You won’t have to worry about the quality and deadlines

Order Paper Now

2  { public:

3     void showPoint( ) const;

4     Point( );

5     Point(int, int);

6     int  xlocation;

7     int  ylocation;

8  } ;

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

2) Now consider the following code segment, assuming the Point class definition from above, and answer the questions below.

1  int main( )

2  {

3     Point.xlocation = 3;

4     Point.ylocation = 10;

5 Point p1;

6 p1 = 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:


Looking for a Similar Assignment? Let us take care of your classwork while you enjoy your free time! All papers are written from scratch and are 100% Original. Try us today! Use Code FREE15