C++ Helper function that is not declared in Header (internal linkage? static? inline? friend?) -


is possible declare addition helper function in cpp not declared in header file have access private members of class?

something this:

myclass.h:

class myclass     public:     myclass();     int test(int num);     int add; }; 

myclass.cpp:

#include "myclass.h"  static int myclass::_helperfunc(int num);  myclass::myclass() {     add = 4; }  int myclass::test(int num) {     return _helperfunc(num); };  static int myclass::_helperfunc(int num) {     return num + add; } 

or there other way extend definition of class without subclassing it?

the point have multiple implementations of class dynamically loaded main application (see: multiple-shared-libraries-from-one-project-with-common-source-files).


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -