Resolving conflicting functions

Derek Parnell derek at nomail.afraid.org
Mon Dec 3 16:48:34 PST 2007


I have a Currency data type,based on a struct.

I want to divide a Currency value by a scalar to return a Currency and I
want to divide a Currency value by another Currency value to return a
scalar. This below is my attempt but fails to compile. How does one do
this?


    // ------------------------    
    real opDiv(Currency pFactor)
    // ------------------------    
    {
       return mData / pFactor.mData;
    }
    
    // ------------------------    
    Currency opDiv(T)(T pFactor)
    // ------------------------    
    {
       Currency temp;
        
       temp = this.mData / pFactor;
       
       return temp;
    }
    
I get the message ...

    template Currency.opDiv(T) conflicts with function Currency.opDiv


-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
4/12/2007 11:44:07 AM


More information about the Digitalmars-d-learn mailing list