There is one file with two separate classes and one function:
int foo(int x) {return x+x;}
class A {
    public:
    int bar(){return foo(0);} 
};
class B {
    public:
    int bar(){return foo(1);}
};
and they both need to use function
which uses only its argument (not use any data from A or B). I can declare this function as global. But i would like to hide this function for other files (so this is un visible, unacccesible in other files). So i can declare this function as member function of each class A and B. But this will be code duplicate.
What is the best practice for that?
 
     
     
     
     
     
    