От: | st0nx | ||
Дата: | 11.06.11 13:33 | ||
Оценка: |
#include <iostream>
using namespace std;
class A
{
public:
virtual int XplusY(int x, int y) = 0;
virtual int operator() (int x, int y)
{
return XplusY(x,y);
};
};
class B : public A
{
public:
int XplusY(int x, int y)
{
return x+y;
};
double XplusY(int x1, int x2,int y)
{
return x1*x2+y;
};
int operator () (int x1, int x2,int y)
{
return XplusY(x1,x2,y);
};
};
int main(int argc, char* argv[])
{
B b;
double x1,x2;
x1 = 12;
x2 = 32;
std::cout<<b(x1,x2);
return 0;
}
/home/kubik/C++ Project/test1/main.cpp||In function ‘int main(int, char**)’:|
/home/kubik/C++ Project/test1/main.cpp|43|error: no match for call to ‘(B) (double&, double&)’|
/home/kubik/C++ Project/test1/main.cpp|29|note: candidate is: int B::operator()(int, int, int)|
||=== Build finished: 2 errors, 0 warnings ===|