Hi,
I am trying to develop abstract design pattern code for one of my project as below.. But, I am not able to compile the code ..giving some compile errors(like "unresolved external symbol "public: virtual void __thiscall Xsecs::draw_lines(double,double)" (?draw_lines@Xsecs@@UAEXNN@Z)" ).. Can any one please help me out in this...
#include "stdafx.h"
#include <iostream>
#include <vector>
#include "Xsecs.h"
using namespace std;
//Product class
class Xsecs
{
public:
virtual void draw_lines(double pt1, double pt2);
virtual void draw_curves(double pt1, double rad);
};
class polyline: public Xsecs
{
public:
virtual void draw_lines(double pt1,double pt2)
{
cout<<"draw_line in polygon"<<endl;
}
virtual void draw_curves(double pt1, double rad)
{
cout<<"Draw_curve in circle"<<endl;
}
/*void create_polygons()
{
cout<<"create_polygon_thru_draw_lines"<<endl;
}*/
};
class circle: public Xsecs
{
public:
virtual void draw_lines(double pt1,double pt2)
{
cout<<"draw_line in polygon"<<endl;
}
virtual void draw_curves(double pt1, double rad)
{
cout<<"Draw_curve in circle"<<endl;
}
/*void create_circles()
{
cout<<"Create circle"<<endl;
}*/
};
//Factory class
class Factory
{
public:
virtual polyline* create_polyline()=0;
virtual circle* create_circle()=0;
};
class Factory1: public Factory
{
public:
polyline* create_polyline()
{
return new polyline();
}
circle* create_circle()
{
return new circle();
}
};
class Factory2: public Factory
{
public:
circle* create_circle()
{
return new circle();
}
polyline* create_polyline()
{
return new polyline();
}
};
int _tmain(int argc, _TCHAR* argv[])
{
Factory1 f1;
Factory * fp=&f1;
return 0;
}