Hi All,

I'm having a problem with a friend function I am using. The darn thing just won't compile!

It goes something like this

class G 
{
protected:
  public:
     void reduce(H& Cost);
};
void G::reduce(H& Cost)
{
     Cost = Cost * 0.95;
}

and later

Class H
protected: 

friend void reduce(H& Price);

float Price;

I get a few errors;
expected ; before ( token
void G::reduce(HardwareDevice& Cost) is not a static member of class G
H not declared in this scope
reduce not declared in this scope

Any ideas appreciated.

Thanks

since you did not post the exact code I dobt anyone can help you. I hope that is not really the way you declared class H. :eek:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.