Class A{......};
class B{
public:
void function(A * p_obj)
{
//Do Something
}
};
int main()
{
B obj;
obj.function(new A()); // need clarification here
return 0;
}
in the above code
1) is the memory created in heap and class pointer pushed to stack of function.
1) will it lead to memory leak
2) who will delete new a() efficiently in above code, caller or callee function?