I need to debug this program for class and I am getting two errors when trying to output myPointPtr.x and myPointPtr.y. The error message is, E0153 expression must have class type but it has type "Point *" I am just learning about member functions. Can anyone guide me in the right direction please?
The error message is the same for each error.
#include <iostream>
using std::cout;
struct Point{
int x, y;
Point(int u, int v) : x(u), y(v) {}
void doubleVal(){
x *= 2;
y *= 2;
}
};
int main() {
Point myPoint(5, 2);
myPoint.doubleVal();
cout << myPoint.x << " " << myPoint.y << "\n";
Point *myPointPtr = new Point(8, 6);
cout << myPointPtr.x << " " << myPointPtr.y << "\n";
return 0;
}