Here's my scenario ...
I have two classes class A & B
Code:// A.h Class A { private: void nicefoo(); void badfoo(); }How do i achieve this...?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 ? }
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?



LinkBack URL
About LinkBacks



