标题:各位高手求帮忙看看纯虚函数
只看楼主
编程的乐趣
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
威 望:1
帖 子:229
专家分:1027
注 册:2011-4-4
结帖率:100%
已结贴  问题点数:20 回复次数:2 
各位高手求帮忙看看纯虚函数
#include<iostream>
using namespace std;

class shape  
{
public:
    shape();
    virtual ~shape();
    virtual void Point::display();
   
  
};
#include<iostream>
using namespace std;
#include"shape.h"

class Point:public shape  
{private:
  float x1;float y1;
public:
    Point();
    virtual ~Point();
    Point(float a,float b):x1(a),y1(b){}

   
    void display()
    {cout<<x1<<","<<y1;}

};

#include "stdafx.h"
#include<iostream>
#include"Point.h"
#include"shape.h"
using namespace std;
int main(int argc, char* argv[])
{Point p(2,3);

   
  p.display();
    printf("Hello World!\n");
    return 0;
}
搜索更多相关主题的帖子: 虚函数 
2011-04-24 12:31
Noll_Nie
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:71
专家分:139
注 册:2011-4-19
得分:7 
这里面有纯虚函数吗?
2011-04-24 13:38
lintaoyn
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:小飞侠
威 望:4
帖 子:605
专家分:2489
注 册:2009-4-8
得分:7 
你代码里只有虚函数,没有纯虚函数。
虚函数必须有定义。

迭代的是人,递归的是神。
2011-04-24 14:59



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-337747-1-1.html




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

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