#include <iostream>
using namespace std;
// Polynomial Class Definition /////////////////////////////////////////////////////
class Polynomial
{
// arithmetic operator overloads prototyped as friend functions
friend Polynomial operator+(const Polynomial&, const Polynomial&);
friend Polynomial operator+(const double, const Polynomial&);
friend Polynomial operator+(const Polynomial&, const double);
friend Polynomial operator-(const Polynomial&, const Polynomial&);
friend Polynomial operator-(const double, const Polynomial&);
friend Polynomial operator-(const Polynomial&, const double);
friend Polynomial operator*(const Polynomial&, const Polynomial&);
friend Polynomial operator*(const double, const Polynomial&);
friend Polynomial operator*(const Polynomial&, const double);
public:
// constructors and destructor prototypes
Polynomial(int t);
Polynomial();
Polynomial(const Polynomial& p);
Polynomial& operator=(const Polynomial& p);
~Polynomial();
// member function prototypes
void changeCoefficiant(int term, double coefficiant);
double getCoefficiant(int term);
int numterms();
double evaluate(double x);
private:
double* coefficiants; // dynamic array to hold coefficiants of polynomial
int terms; // number of terms in polynomial, including all that evaluate to 0
}; // Polynomial declaration
and it allways gives me 1 error when it reaches the line
friend Polynomial operator+(const Polynomial&, const Polynomial&);
---------error-----------
d:\development\eve\polynomial.cpp(10) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file ''msc1.cpp'', line 1786)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Error executing cl.exe.
eve.exe - 1 error(s), 0 warning(s)
this is the first time i''m trying to overload the arithmetic operators and as far as I can tell i''m doing everything the book says.
My definitions are all done with the same prototypes as the overloads defined outside the public: line of my class, minus friend and with the variable names for the arguments.
Can someone help me out please?
Internal compiler error VC++6.0
here''s my class definition
The problem arises from the combination of the using namespace declaration, and the friend declaration. Read all about it here. It should be solved by downloading the latest Service Pack.
"Sneftel is correct, if rather vulgar." --Flarelocke
"Sneftel is correct, if rather vulgar." --Flarelocke
quote:Original post by Invader X
Do you have the latest service pack?
Colin Jeanne | Invader''s Realm
i thought i might of.. but that might of been me confusing the remembering to get it, with remembering that i got it.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement