free functions (or static members) to access private function from different class
Here's my scenario ...
I have two classes class A & B
Code:
// A.h
Class A
{
private:
void nicefoo();
void badfoo();
}
Code:
//B.H
Class B
{
public :
static void firstFreeFoo();
static void secondFreeFoo();
}
void B::firstFreeFoo()
{
A.niceFoo(); // I need to call nicefoo ?
}
void B::secondFreeFoo()
{
A.badFoo(); // I need to call badfoo ?
}
How do i achieve this...?
my thoughts...
1. Perhaps i can declare an instance of A inside both static functions, but then both nice&bad foo are private
2. If i do declare two instance of foo, then i have too many class A instances, what if there are many static functions to use A? Isn't it a problem to have too many instances.
3. Should A be a singleton?