//triangle.cpp #include<iostream> #include"triangle.h" using namespace std; Triangle::Triangle(int x,int y,int a,int b,int m,int n) { m_cA=new Coordinate(x,y); m_cB=new Coordinate(a,b); m_cC=new Coordinate(m,n); } Triangle::Triangle() { cout<<"Triangle()"<<endl; } virtual Triangle::~Triangle() { delete m_cA; m_cA=NULL; delete m_cB; m_cA=NULL; delete m_cC; m_cA=NULL; cout<<"~Triangle()"<<endl; } //triangle.h #ifndef TRIANGLE_H #define TRIANGLE_H #include"coordinate.h" class Triangle:public Coordinate { public: Triangle(int x,int y,int a,int b,int m,int n); Triangle(); virtual~Triangle(); private: Coordinate *m_cA; Coordinate *m_cB; Coordinate *m_cC; }; #endif //提示错误一个error C2723: '__dtor' : 'virtual' storage-class specifier illegal on function definition
onemoo
相关分类