nvm I fixed it, I was being very dim. It was assigning my pointer a random garbage value rather than 0 and to avoid memory leaks a segment of my code has a delete in it, and that caused the segmentation fault I think. It for some reason didn't print anything I told it to, which is why I assumed it was a problem with the declaration. I fixed it by putting ptr=0; at the beginning of all my constructors (I am definitively a noob in the world of programming).