Suppose you were defining a string in the default constructor. Now, suppose you wish to append something to that string in the parametric constructor. Does the parametric constructor automatically erase whatever was defined in the default constructor? It seems to be doing this for me. Now, I would like to know why it would be doing this.
Also, I was wondering if, once a parametric constructor is called (this constructor is only setting one private variable, mind you), if the better way to set that variable again would be:
a.) From a friend class, directly setting it or
b.) Calling the parametric constructor again with the new value
I am resetting the private value to call some of the class's functions again.
Something similar in the C++ standard library is opening files with fstream. You can open the file from the constructor: std::ofstream fout("Myfile.txt");
or you can open the file later with the .open() function fout.open("Myfile.txt");