[ create a new paste ] login | about

Link: http://codepad.org/TOTixB1a    [ raw code | output | fork ]

rhag - C++, pasted on Jun 3:
struct ShapeInterface
{
 virtual void Draw()=0;
 virtual void SetName(char* name)=0;
 virtual char* GetName()=0;
};
struct CircleInterface:public ShapeInterface
{
  virtual void SetRadius(double radius)=0;  
};
class ShapeImpl:public ShapeInterface
{
  virtual void SetName(char* name){/*save it somewhere*/}
  virtual char* GetName(){/*return it*/ return NULL;}
};
class CircleImpl:public CircleInterface,public ShapeImpl
{
 virtual void Draw(){/*draw a circle*/}
 virtual void SetRadius(double radius){/*set the radius*/}
};

int main()
{
 CircleImpl circle;
 return 0;
}


Output:
1
2
3
In function 'int main()':
Line 24: error: cannot declare variable 'circle' to be of abstract type 'CircleImpl'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: