Mail Archives: djgpp/1999/10/10/21:05:51
From: | Mike Huang <monhuang AT yahoo DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | operator overloading error
|
Date: | Sun, 10 Oct 1999 18:22:21 -0400
|
Organization: | California Institute of Technology, Pasadena
|
Lines: | 36
|
Message-ID: | <3801119D.531FBBEC@yahoo.com>
|
NNTP-Posting-Host: | 155-ppp-its.caltech.edu
|
Mime-Version: | 1.0
|
X-Mailer: | Mozilla 4.61 [en] (Win98; I)
|
X-Accept-Language: | en
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hello,
I have the following .h file:
#ifndef _MTX_H
#define _MTX_H
#include <vector>
class matrix {
public:
int col, row;
public:
//2-D array, p836, Stroustrup, The C++ programming language, 3rd Ed.
vector <vector <float> > M;
matrix();
matrix(int numrow, int numcol);
~matrix();
matrix operator* (const matrix&, const matrix&);
};
#endif _MTX_H
but when I compile it with gcc -c mtx.cpp, DJGPP gave me:
mtx.h:18 'matrix::operator *(const matrix&, const matrix&)' must take
either zero or one argument)
I would like to code it so it will work like matrix1 = matrix2 *
matrix3.
What's wrong with my code?
Sincerely,
Mike H.
- Raw text -