@lukes said in C++ syntax question - Defining an object in a class that requires arguments?:
HardwareSerial
Maybe this solves your problem ...
class StaticClass {
private:
int myContent;
public:
StaticClass(int v){myContent = v;}
void printout(){printf("%d\n",myContent);}
};
class TestClass {
public:
//StaticClass myClass = StaticClass(42); // With C11
StaticClass myClass;
TestClass() : myClass(42)
{
}
void doit()
{
myClass.printout();
}
};
int main(void)
{
TestClass tc;
tc.doit();
}