Suppose we have a class: FSimpleClass. The following classes are declared in the SimpleClass header file:
class FExampleClass* ExampleClass1;
class FExampleClass ExampleClass2;
Both classes (variables) are private and are created / initialized inside FSimpleClass.
Suppose that the class FSimpleClass is created and destroyed somewhere during the game. We wrote the destruction of the class ExampleClass1 in the destructor, but do we need to destroy the class ExampleClass2? Will the memory spent on ExampleClass2 be freed after the destruction of FSimpleClass, if this is not done?
And also, is it necessary to write in the destructor:
ExampleClass1 = nullptr;
after delete ExampleClass1, that there would be no dangling pointer? Or the pointer will not be after the destruction of FSimpleClass?