Mail Archives: djgpp/1997/08/07/10:41:33

From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: C++ class interaction and overloading (should be simple answer)
Date: 5 Aug 1997 04:51:10 GMT
Organization: The National Capital FreeNet
Lines: 33
Message-ID: <5s6bfu$>
References: <33E3B107 DOT 63DEA07F AT execulink DOT com> <5s3l9f$o46 AT freenet-news DOT carleton DOT ca> <33E56A0A DOT 3C718232 AT alcyone DOT com>
Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Erik Max Francis (max AT alcyone DOT com) writes:
> Paul Derbyshire wrote:
>> Try omitting the space after "operator":
>>      inline friend Vector operator* (Matrix& mat, Vector& vect);
> The original post hasn't shown up on my server, but this shouldn't be the
> problem.  It's perfectly legal for there to be whitespace between the
> `operator' keyword and the symbol in the function name.  operator new is a
> good example, since you _have_ to have whitespace.  Namely, I do it all
> the time.

Well, there's also that he has the vector reversed now that I look a second
time. Vector * Matrix seems to be what he wants, so there should be
(Vector &vect, Matrix &mat) for params.

And, to make it easy to use, he needs to make a double dispatcher in Matrix:

inline friend Matrix operator* (Matrix &mat, Vector &vect) {
  return vect*mat; // Matrix*vector calls vector*matrix which does the math.

And, you can redefine new? How's this done...and why, to make a handler
for exhausted heap?

    .*.  Where feelings are concerned, answers are rarely simple [GeneDeWeese]
 -()  <  When I go to the theater, I always go straight to the "bag and mix"
    `*'  bulk candy section...because variety is the spice of life... [me]
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca,

- Raw text -

  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019