Category : methods

class Controller { bool isBackendActive(); void anotherMethodDoingSomething(); } Can I declare a boolean variable with the same name as a method so that I can use it like this: void Controller::anotherMethodDoingSomething() { bool isBackendActive = isBackendActive(); if (aBoolean && isBackendActive) { … LOG("bla" + isBackendActive) } else if (!isBackendActive) { … } else … } ..

Read more

I want to define a special string structure as follows: struct MyString{ std::string ReturnAsString(){ // here I want to return the string "AB" from Foo() return MyString; // wrong but this is what I want } MyString Foo(){ return {"AB"}; } Of course, this is just a sample, and I need MyString because it has ..

Read more