计算机小混子 2022-04-12 19:57 采纳率: 100%
浏览 10
已结题

如下图标编译器报错求原因和解决办法


#ifndef _POINT_H
#define _PIONT_H
class Point {//类的定义
public://外部接口
    Piont();
    Piont(int x, int y);
    ~Piont();
    void move(int newX, int newY);
    int getX() const { return x; }
    int getY() const { return y; }
    static void showCount();//静态数据成员
private:
    int x, y;
#endif  //_PIONT_H



};

#include <iostream>
#include "Piont.h"
using namespace std;
Point::Point() {
    x = y = 0;
    cout << "Default Constructor called." << endl;

}
Point::Point(int x, int y) :x(x),y(y) {
    cout << "Constructor called." << endl;
}
Point::~Point() {
    cout<<"Destructor called." << endl;
}
void Point::move(int newX, int newY) {
    cout << "Moving the point to(" << newX << "," << newY << ")" << endl;
    x = newX;
    y = newY;


}
// 6-3对象数组应用举例.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include "Piont.h"
using namespace std;
int main()
{
    cout << "Entering main..." << endl;
    Point a[2];
    for (int i = 0; i < 2; i++)
        a[i].move(i + 20, i + 20);
    cout<<"Exiting msin..." << endl;
    return 0;

}


img

img

  • 写回答

1条回答 默认 最新

  • 非西昂 2022-04-12 20:53
    关注

    img


    写错了,俩都不一样

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 4月20日
  • 已采纳回答 4月12日
  • 创建了问题 4月12日

悬赏问题

  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来