Let say I've decleared this within MyTools.h
#ifndef _MYTOOLS_
#define _MYTOOLS_
typedef struct {
// const
double LN20;
double LN40;
// methods
double NoteToFrequency(int noteNumber);
} Tool;
extern const Tool tool;
#endif // !_MYTOOLS_
For every compilation unit, there is only a global/const/unique instance of Tool
. Exactly what I want.
But now: how can I define it? In the .h
i've only declared it. How can I define it in .cpp
? Tried somethings like:
tool.LN20 = 1.34;
But of course it doesn't works. And the method's definition?