Code:
    class frac
     {
      public:
        frac(const double& d = 0);
        frac(const frac& f);
        frac operator = (const frac& f);
        frac operator *= (const frac& f);
        frac operator /= (const frac& f);
        frac operator += (const frac& f);
        frac operator -= (const frac& f);
        template<typename _VT>
        frac operator = (const _VT& v);
        template<typename _VT>
        frac operator *= (const _VT& v);
        template<typename _VT>
        frac operator /= (const _VT& v);
        template<typename _VT>
        frac operator += (const _VT& v);
        template<typename _VT>
        frac operator -= (const _VT& v);
        double aprox();
        int& numer(); 
        unsigned int& denom(); 
//      private:
        int p_numer;
        unsigned int p_denom;
        void setaprox(double d);
        void simplify();
     };
Code:
  int& frac::numer() { return p_numer; }
Code:
  inline bool operator == (const frac& f1, const frac& f2)
   { return (f1.numer() == f2.numer() && f1.denom() == f2.denom()); }
As you can guess, this is just a small piece of the full code, which I have based largely off of the standard #include file, "complex" , which I've attached if you care to look at it. Originally, I have p_numer and p_denom as public. Taking my cue off of the "complex" file I mentioned, I decided to make them private, and use a function that would return the value of those variables. What really bugs me is that I actually copied and pasted the declaration of the variable, the declaration of the function, the definition of the function, and the definition of the == operator, changed the variable names, and chaged the typename variables to int or unsigned int (the complex class is templated). I still get this error, though...
Code:
passing 'const std::frac' as 'this' argument of 'int& std::frac::numer()' discards qualifier
every time I try to call the function, as in the == operator. And, of course, the same goes for the denom() function. Does anyone have any idea why this is? My best guess is that the complex class is templated, and mine isn't, but that just seems stupid...