我正在尝试显示我通过成员函数创建的 Point 类的 p 对象。我已将 Point p 作为参数传递给我的程序的 void displayPoint(Point p) 成员函数。但是我的程序中出现以下编译错误!
D:\OOP 赋值 #01\point.cpp[Error] 没有匹配 'operator<<'(操作数类型是 'std::ostream {aka std::basic_ostream}' 和 'Point')
下面是我的代码!!!
#ifndef POINT_H
#define POINT_H
using namespace std; // For string usage
class Point
{
public:
Point(); // Default Constructor
Point(double, double, int); // Three argument constructor
void initialize(double, double, int);
void shift(Point p, int keyPress); // Shift the first point
void setValue(int value);
int getValue() const;
void setX();
double getX() const;
void setY();
double gety() const;
void …Run Code Online (Sandbox Code Playgroud)