hii to all i am very new to c++ . i am learning c++ while i try to compile this program it give error as "pair as ambiguous symbol" error.
in this program iam trying to understand the how polymorphism works.
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include "mouse.hpp"
using namespace std;
class pair
{
public:
pair(int xx=0, int yy=0);
int x() const;
int y() const;
private:
int x_value, y_value ;
};
class shape
{
public:
virtual void rotate(double);
virtual double get_area() const;
pair get_position() const;
protected:
pair centre;
};
class circle : public shape
{
public:
void rotate(double) const
{
}
double get_area() const
{
return pi*rad*rad;
}
protected:
static const double pi;
double rad;
};
class rectangle : public shape
{
public:
double get_area() const
{
return size.x()+size.y();
}
protected:
pair size;
};
int _tmain(int argc, _TCHAR* argv[])
{
circle c;
rectangle r;
shape *ps=&c;
cout<< ps->get_area();
getch();
return 0;
}