注册 登录
编程论坛 C++教室

各位高手求帮忙看看纯虚函数

编程的乐趣 发布于 2011-04-24 12:31, 469 次点击
#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;
}
2 回复
#2
Noll_Nie2011-04-24 13:38
这里面有纯虚函数吗?
#3
lintaoyn2011-04-24 14:59
你代码里只有虚函数,没有纯虚函数。
虚函数必须有定义。
1