Re: friends

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Wed Jul 01 1998 - 21:45:14 MEST


Hi Chris,

yes, friends are just normal functions that can access certain class
internals. To add a friend (or any other function) to a dictionary 
specify it in your LinkDef.h file like this:

#pragma link C++ function operator*(Float_t,TH1C&);

Cheers, Fons.

PS: if you think your ThreeVec class is good enough for the rest of the
    community, please make it available.


Chris Jillings wrote:
> 
> Hi all,
>     I have gone from simple root programming to jumping in the deep end.
> I have a class, QThreeVec, which handles 3-vectors in an elegant way. It
> has been working for years here in other codes.
>     I took on the task of rootifying it. The code compiles but the
> dictionary generation fails. I thought that perhaps friend functions were
> causing the trouble. The friend functions are ncessary to ensure that an
> expression like
> ThreeVec u,v;
> Float_t a;
> v=u*a;
> 
> behaves in the same way as
> v=a*u;
> 
> Does the dictionary handle friends?
> Thanks,
> 
> Chris
> 
> =================================================================
> =                                                               =
> = Chris Jillings                                                =
> = Department of Physics   phone/voice mail: (613) 545-6000x4805 =
> = Queen's University      fax: (613) 545-6813                   =
> = Kingston, Ontario       email: chris@sno.phy.queensu.ca       =
> = Canada, K7L 3N6         web: http://sno.phy.queensu.ca        =
> =                                                               =
> =================================================================

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:34 MET