| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 555 人关注过本帖
标题:错误提示求翻译
只看楼主 加入收藏
printf0
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2010-7-13
结帖率:50%
收藏
 问题点数:0 回复次数:4 
错误提示求翻译
error C2259: 'point' : cannot instantiate abstract class due to following members:
C++编译时出现的错误~额 理解不了是什么意思
搜索更多相关主题的帖子: 提示 翻译 
2010-12-08 00:04
printf0
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2010-7-13
收藏
得分:0 
// GA.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
using namespace std;
class shape
{
public:
    virtual float area() const =0;
};
class point:public shape
{
public:
    point(float=0,float=0);
    setpoint(float,float);
    float area();
    getx();
    gety();
    operator + (point &p);
    operator + (int p);
private:
    float x,y;
};
point::getx()
{return x;}
point::gety()
{return y;}
point::setpoint(float a,float b)
{x=a;x=b;}
point::operator + (point &p)
{
    return setpoint(x+p.getx(),y+p.gety());}
point::operator + (int p)
{
    return setpoint(x+p,y+p);}
float point::area()
{
    cout<<x<<","<<y<<endl;
    return 0;
}
class circle:public point
{
public:
    circle(float=0,float=0,float=0);
    setcircle(float a,float b,float r);
    float area();
    operator + (point &p);
private:
    float x,y;
    float ra;
};
circle::setcircle(float a,float b,float r)
{
    x=a;y=b;ra=r;
}
circle::operator + (point &p)
{return setcircle(x+p.getx(),y+p.gety(),ra+0);
}
float circle::area()
{
    cout<<3.14*ra*ra<<endl;
    return 0;
}

int main(int argc, char* argv[])
{
    point p(1.5,1.7);
    p.area();
    //circle c(1.5,1.3,1.5),cp;
    //cp=c+P;
   


   
    printf("Hello World!\n");
    return 0;
}

额 源程序是这样的
2010-12-08 00:17
printf0
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2010-7-13
收藏
得分:0 
定义了一个抽象基类,一个点类,一个圆类,想求 圆+点 之后圆的面积
2010-12-08 00:40
smilekurt
该用户已被删除
收藏
得分:0 
提示: 作者被禁止或删除 内容自动屏蔽
2010-12-08 11:39
danpandong
Rank: 2
等 级:论坛游民
帖 子:8
专家分:17
注 册:2010-12-8
收藏
得分:0 
是哪一行错了呢?
2010-12-08 18:23
快速回复:错误提示求翻译
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014083 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved