// myHeader.hpp
class Foo {
public:
Foo(SomeClassPtr *ptr, std::string text);
Foo(std::string text);
Foo();
// some code where it is checked that scPtr is not a nullptr
~Foo();
private:
SomeClassPtr *scPtr=nullptr;
// some other members
}
I don't want to write scPtr=nullptr in the 2 Foo constructors that don't have the SomeClassPtr as an argument I just made the scPtr a nullptr by default.
Now I want to know if this is a bad idea or if this ok to do i.e to define
class variables in a header file.