In C I can have a structure and some public functions declared in a header file, while some "private" functions can be declared as static in a source file. For example:
foo.h
typedef struct Foo {
...
} Foo;
void func1(Foo *foo);
foo.c
#include "foo.h"
static void func2(Foo *foo) {...}
void func1(Foo *foo) {...}
In this case func2
is linked internally. Is this possible with C++ class methods? If I write:
foo.hpp
struct Foo {:
void func1();
private:
void func2();
};
func2
will still be linked externally. Is there a way to make it internal retaining it inside the struct?