G
Gary Wessle
Hi
I need class A to access a method of class B using the friend
mechanism.
// B.h
#include "a.h"
class B
{
double balance;
....
public:
friend A;
double balance() { return balance; } //definition is in a .cpp file
....
};
// A.cpp
A::doing_it()
{
....
double f = B::balance - 5;
};
is this right?
thank you
I need class A to access a method of class B using the friend
mechanism.
// B.h
#include "a.h"
class B
{
double balance;
....
public:
friend A;
double balance() { return balance; } //definition is in a .cpp file
....
};
// A.cpp
A::doing_it()
{
....
double f = B::balance - 5;
};
is this right?
thank you