b is a local variable inside the A() constructor. When the constructor ends b will no longer exist so p_B end up being a pointer to an object that no longer exist, and using such an object is not "safe" and could lead to program crash.
Ok, thanks, i understand. How can i have a pointer to object outside the class where is the pointer? Or, how can i create an object inside a class and assign a pointer to that object?