In additionally to previous answers.
A a; A * pa = &a; a.Method();
pa->Method();
a.value = 42;
As instance of
a
deleted in scope there it was created you can't use
pa
variable outside of that scope (in solution 2 you can see that)
Additionally you should not destruct pa object by calling
delete
But you can compare the pointers as an example:
A a1; A a2;
A * pa = bConditionton ? &a1 : &a2; if (pa == &a1)
{
}
else
{
}
Regards,
Maxim.