Standardparameter erfordert statische Elemente
-
Also folgendes Problem am einfachsten in Code ausgedrückt
class CMyClass { public: CMyClass(int first) : m_first(first) { } Get(int index = m_first) { ... } private: int m_first; };
Fehlermeldung:
... m_first: Das Verwenden von Elementen als Standardparameter erfordert statische Elemente
Was ist falsch und wie löse ich das Problem
-
class CMyClass { public: CMyClass(int first) : m_first(first) { } Get(void) { return m_first; } private: int m_first; };
so vielleicht?
-
Man kann keine Variablen als Defaultwerte übergeben.
Bau zwei Get Funktionen. Die eine nimmt einen Parameter, die zweite ohne Wert, ruft dir erste mit m_first auf.
-
Aha. Ok. Danke.