Question: / / main . cpp #include #include Point.h using namespace std; int main ( ) { / / creating point class pointer object pt

//main.cpp
#include
#include "Point.h"
using namespace std;
int main()
{
//creating point class pointer object pt with coordinates 0,0 and label to origin
Point * pt = new Point{"origin",0,0};
//calling descriptor function using pt and printing the returned string
cout pt->descriptor() endl;
//calling function to update coordinates to 20,20
pt->updateCoords(20,20);
//calling function to update label to pt1
pt->updateLabel("pt1");
//calling descriptor function using pt and printing the returned string
cout pt->descriptor();
return 0;
}
//point.h
#ifndef POINT_H
#define POINT_H
#include
using namespace std;
class Point {
public:
int x =0;
int y =0;
string label ="";
Point(const string& label, const int x, const int y);
void updateCoords(const int x, const int y);
void updateLabel(const string& label);
string descriptor() const;
};
#endif
//pointer.cpp
// File: point.cpp
#include "point.h"
#include
#include
using namespace std;
/* Type your code here. */
/* Type your code here. */
/* Type your code here. */
/* Type your code here. */
/ / main . cpp #include #include "Point.h " using

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!