计算机小混子 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日

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭