Hi,
I don't know if this problem has to do with Microsoft Visual Studio, I guess not... probably a mistake of mine. And I have no idea why I'm getting these errors. If someone could help me out, I'd be very thankful.
I'm trying to build my own small library with math functions and variables so my idea was to make a base class for all the variables and then derive them from this one, making complex numbers, matrixes, etc...
So I wrote a basic structure for this base abstract class and then tried compiling just to see if there were any errors, and I got the following:
Code:
1>Compiling...
1>Main.cpp
1>c:\documents and settings\crist?v?o\os meus documentos\visual studio 2005\projects\ubermath\tester\main.cpp(10) : error C2259: 'Variable' : cannot instantiate abstract class
1> due to following members:
1>c:\documents and settings\crist?v?o\os meus documentos\visual studio 2005\projects\ubermath\tester\main.cpp(11) : error C2259: 'Variable' : cannot instantiate abstract class
1> due to following members:
1>c:\documents and settings\crist?v?o\os meus documentos\visual studio 2005\projects\ubermath\tester\main.cpp(12) : error C2259: 'Variable' : cannot instantiate abstract class
1> due to following members:
1>c:\documents and settings\crist?v?o\os meus documentos\visual studio 2005\projects\ubermath\tester\main.cpp(24) : error C2259: 'Variable' : cannot instantiate abstract class
1> due to following members:
1>Build log was saved at "file://c:\Documents and Settings\Crist?v?o\Os meus documentos\Visual Studio 2005\Projects\UberMath\Tester\Debug\BuildLog.htm"
1>Tester - 4 error(s), 0 warning(s)
And this is my code:
Code:
#include<iostream>
class Variable
{
public:
virtual ~Variable();
/*Basic Algebric operators*/
virtual Variable operator+ (Variable &Other) = 0;
virtual Variable operator- (Variable &Other) = 0;
virtual Variable operator* (Variable &Other) = 0;
virtual Variable operator/ (Variable &Other) = 0;
virtual Variable& operator= (Variable &Other) = 0;
/*Other Algebric operators*/
virtual Variable& operator++ () = 0; // Check to see if this is correct (prefix or postfix version), check how to do the other.
virtual Variable& operator-- () = 0;
virtual Variable& operator+= (Variable &Other) = 0;
virtual Variable& operator-= (Variable &Other) = 0;
virtual Variable& operator*= (Variable &Other) = 0;
virtual Variable& operator/= (Variable &Other) = 0;
/*Basic binary operators*/
virtual Variable operator^ (Variable &Other) = 0; // Check for the other ones
/*Basic boolean operatos*/
virtual bool operator== (Variable &Other) = 0;
virtual bool operator!= (Variable &Other) = 0;
virtual bool operator< (Variable &Other) = 0;
virtual bool operator<= (Variable &Other) = 0;
virtual bool operator> (Variable &Other) = 0;
virtual bool operator>= (Variable &Other) = 0;
/*IOstream output operators*/
//look for them.
private:
protected:
};
void main()
{
std:: cout << "Done!\n\n";
return;
}
So thanks for reading this!