[ROOT] operator in a namespace question

From: Ray Fliller III (rfliller@bnl.gov)
Date: Fri Apr 18 2003 - 21:56:58 MEST


  Hello Rooters.

    I am using ROOT cvs from Monday 4/11 on LINUX.  My question is this,
  I have a the following class:

namespace FOO{

  class bug{
  private:
    int i;
    
  public:

    bug(int j);
    int get();
    void set(int j);
    friend bug operator+(const bug& rhs, int c);
  };
};


Using the following LinkDef.
#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ namespace FOO;
#pragma link C++ nestedclasses;

#pragma link C++ class FOO::bug-!;
#pragma link C++ function FOO::operator+(const bug&, int);
#endif

It compiles fine, but when I go to use it, I get the following problem:

root [0] FOO::bug c(10)
root [1] c.get()       
(int)10
root [2] c+10          
Error: operator+ not defined for FOO::bug FILE:(tmpfile) LINE:1
*** Interpreter error recovered ***
root [3] using namespace FOO
root [4] c+10               
(class FOO::bug)146564000
root [5]     

Attached are the files (along with the .cxx).  I know that not using a
namespace would be easier, but in this case, I am constrained to using
one.  Any help will be appreciated. 

This is of course the usual stripped down version of a complicated
problem! :-)

Thanks.

-- 

 RAINMAN
      "How much does a piece of gum cost Ray?"
      "About $100."
      "How much does a new car cost Ray?"
      "`Bout $100."
      "There goes working for NASA!"

==================================================================
Ray Fliller: rfliller@bnl.gov      Office Phone: (631)-344-6124 
C-A Accelerator Physics            Dept. Fax: (631)-344-5954
Building 911B
Brookhaven National Lab
Upton, NY 11973                    Office: Room 211

http://www.agsrhichome.bnl.gov/People/rfliller/
==================================================================



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:11 MET