Here is a super quick example of what I am thinking.
// Example program
#include <iostream>
#include <string>
class Obj
{
private:
    int myInt;
public:
    Obj()
    {
        myInt = 0;
    }
    ~Obj()
    {}
    
    void increment()
    { 
        myInt++; 
    }
    int getInt() 
    { 
        return myInt; 
    }
};
class A
{
public:
    Obj* myObj;
    A()
    {
        myObj = nullptr;
    }
    ~A()
    {
        if(myObj)
        {
            delete myObj;
            myObj = nullptr;
        }
    };
    
    void myFunc(Obj* o)
    {
        myObj = o;
    }
};
int main()
{
    A* a = new A();
    a->myFunc(new Obj());
    a->myObj->increment();
    delete a;
}
Just as a hypothetical .... regarding the above code - specifically the line
a->myFunc(new Obj());
It compiles fine, but is there anything functionally wrong with doing this? Other than maybe poor form, or going against best practices?
 
    