Re: C++ operators 1999 22:34:56 EST." <Pine.LNX.3.96.990304223027.28127A-100000@cc569157-a.warn1.mi.home.com>

From: Jeremy Elson (jelson@circlemud.org)
Date: 03/04/99


Maybe I'll de-lurk for once. :-)

Daniel Burke writes:
>ch->points.hit = 10;
>
>The operator I need would take that, and allow me to have things trigger on
>that assignment.  I think I need something like:
>
>void operator = (int x, int y);
>
>But I know that's not exactly what I need for it to only work on a specific
>member variable.  Any help or point in the right direction will be greatly
>appreciated.

You can't have it happen for that variable only, unless that variable
is of a unique type (i.e., if you made points.hit be a HitPointType
instead of an int).  Then you could define
HitPointType::operator=(int).

-j


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST