dave
New Member
Posts: 3
|
Post by dave on Dec 31, 2008 12:25:15 GMT -5
Hey Mr. Steinberg I was thinking the other day about what the header files that we use in C++ actually are. Along this train of thought, I remembered that headers such as iostream.h are simply special text files that contain functions and sometimes classes. So, theoretically, I could write my own header file, for example dave.h, that would contain all of my functions, such as the Shuffle and GetCard functions, and if I included the header file, I could call that function without a prototype. I understand that I would probably need to set a syntax and default parameters for the functions, and this may be too complicated, but I would just like some more info on the subject. Thanks in advance for the help
|
|
|
Post by Bobby Steinberg on Dec 31, 2008 14:23:28 GMT -5
Dave, Actually, that is the very beginning of Object-Oriented programming. And to answer your question, yes, it is very possible to do what you are asking. You could structure your own functions after those in "iostream.h" or any other header file. Just remember, in order to do that, your compiler needs to know where the "dave.h" file is located, and if you run it on another computer, you will need to include it somehow, otherwise your program will only be able to be compiled on your own computer. In CodeWarrior, "iostream.h" is in a very specific place that the compiler knows the path to it. We can set that up so you can build your own libraries of functions. We can talk about it on Monday.
|
|