It is very odd to me. Regular variables do not give this much of a head ace. I am just testing some pointer code I made in the artist class.I know it starts out as null because i declare it null but i assigned values with the set functions so in theory it should not be doing that.Any help would be appreciated.
the constructor for your class sets the firstname pointer but there is no memory for it (a 'new' statement) anywhere.
this should probably be
//Default Constructer
Artist::Artist() {
//Now a pointer.
*firstName = new string;
*firstName = "";
and your destructor needs to delete it.
if the point of this is to learn about pointers, carry on.
if the point is something else, there is no reason in the world to make a string * in your class. the guts of the string are a pointer already, so you don't gain anything for your aggravation.
Even if this is an exercise in learning about pointers, don't use new to merely obtain a pointer. There is std::addressof or plain & (address operator).
As jonin pointed out std::string puts it's data on the heap.
Other things to consider:
Use an STL container, like std::vector, all it's data is on the heap too.
References were invented to use instead of raw pointers. They are similar, but a reference can't be made to refer to something else, unlike a pointer which can be made to point at anything, including nothing. Consider using nullptr instead of NULL
There are smart pointers such as std::unique_ptr which involves move semantics, and std::shared_ptr. This stuff might be a bit advanced right now, but at least you have heard of them.
All these suggestions are about doing proper C++ : not using raw pointers, and not doing ones own memory management.
Unfortunately there are many who still teach a mixture of C and C++, so we get C techniques wrapped up in C++ which is terrible.
Good Luck !!
Edit:
Rather than creating a new topic each time, please just continue with 1 topic about the same code. Multiple topics are a time waster for those who reply: the same things are said over and over. Just a friendly reminder :+)