Archived

This topic is now archived and is closed to further replies.

iNfuSeD

Internal compiler error VC++6.0

Recommended Posts

here''s my class definition
#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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites