Ok, so I have a class, and one of its "variables" is a string object. The constructor for the class takes a string argument, and assigns it to that string object. However, it doesnt seem like it wants to do that, because when i try output it, nothing comes out...
So exactly which object does pMeow point to here? A temporary object that ceases to exists as soon as this line of code has executed. It's nothing to do with the pointer- it's to do with the fact that temporary objects stop existing very quickly.
well, the way it works, it goes into an if statement to assign the pointer based on user input, so if i do that, then wouldnt the object cease to exist after the scope ends?
It's up to you to make sure objects exist as long as you need them to.
This meow* pMeow = &meow("Harold"); creates a temporary that dies pretty much instantly, and leaves you with a pointer that points at useless memory. Don't do this.
This meow someObject("Harold"); creates one that lasts until the end of scope. If you need it above that scope, create it above that scope.
This meow* pMeow = new meow("Harold"); creates one that lasts until you delete it yourself.
Frequently, you can avoid using new by planning your code properly. When that's more trouble than it's worth, or you run out of room on the stack, you've got new.