I have constructor for my base class named BaseClass
BaseClass::BaseClass(BaseClass* parent)
{
if (parent != 0)
{
parent->children.push_back(this);
}
this->parent = parent;
ready = 1;
}
This method checks if pointer to parent object is 0 or null and sets it as parent of current object and after it sets ready state of current object to 1.
I read articles where author used nullptr
keyword in pointer declaration. C++ also allows me to use 0 to declare null pointer but should I use nullptr
keyword instead of 0 in my constructor for example if I pass null pointer to it as 0?