They seemed to make sense to me, until I read somewhere than an example of a constructor is
std::ifstream myFile("filename.txt");
..the author went on to say that (obviously, in this example) they can be called after an object is instantiated, ie:
std::ifstream myFile;
// some code here
myFile.open("filename.txt")
This intuitively makes sense, as you may want to declare your variables near the top of your code, and initialize them later..
But if constructors always have the same name as the class itself, then why is myFile.open() a constructor?
And if I have a class CImgDisplay (for example), and I want to declare an object CImgDisplay main_disp;
then how do I know what name to call the constructor with later? Do I have to go digging through the header file?
Or is that ifstream example a bad example or something?
Sorry for the dumb question.. I've got 2 days to finish my project, and I've never done objects before.. according to all the books I have, the only way it can be done is by initializing it all in one go..