Hi every one.
First of all I'll excuse me for the misspellings you'll find in the following text.
I'm trying to find out a way to encapsulate the primitive numeric types into a single interface so I will be able to define dependant classes such as Point, for saying, without explictly defining the numeric type and, at the same time, avoid using a Template class. So I tried to define within the abstract base class called Scalar (representing any scalar set) I defined the common operations by overloading the aritmetic, comparative and assignment operators. And finally I tried to overload the casting operator (as I think it is) called
Scalar::operator()(void) and declared it for every combination of numeric declaration (char,short int,int,long int,long long int, unsigned, and so on);
When I compiled it using MinGW the compiler throwed a error saying that every operator overload distinct that the one declared as int Scalar::operator()(void) was overriding this declaration.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
class Scalar{
public:
Scalar();
Scalar(const Scalar&);
/** aritmetic, comparative and assignment operators **/
// here the compilers says that i'm overriding the int operator()(void);
char operator()(void) = 0;
// this one throws no errors
int operator() (void) = 0;
// same error as in char
unsigned int operator()(void) = 0;
// same error as in char
long double operator()(void) = 0;
/** and so on... */
}
|
I've derived the class Integer from this one for testing and well as it fails here it also fails there.
Does anyone have a clue on what's going on..
Thanks in advance
Looking forward for hearing any answer on this subject.