Sweet, thanks for the answers guys!
I imagine everything included into a single file for compilation or during compilation as well and that was going to be one of my next questions. If I had hundreds of classes (.h/.cpp for each) and had a single header file that #included everything that every class would ever need to communicate between each other; how horrible is that for the compiler or performance?
I personally want to stray away from "const" because it's just more words to type when you already have to type so much when programming. I was just wondering if it was a compiler performance benefit using "const" in functions that you knew, in that situation, the value is passed by value but will not be changed.
Helped tons, Casey. I come from a long programming history, obviously in languages outside of C, made the mistake[?] of learning C# first in college but had the reasons, and have been slowly backed into a corner to start learning AND using C. Several sites/videos later it was only your videos that made everything start making more sense to me and gave me a giant boost in confidence and motivation to just dive right into everything.
insanoflex; Thank you very much. In your first #include foo example this would be overall better than having a global header that just included everything in your project? This is basically the same question as my first question in this reply.
I didn't know that about inline functions, I was wondering why I kept getting errors whenever I tried to use them, and I kept wanting to do something like:
| inline int GetID(){ return ID; }
|
I don't know.. just felt good typing that in a single line and be done with the function and purpose.
Overall I thought "const" had some kind of benefit behind the scenes and was looking for clarity on the subject. What I had in mind was that the compiler would decide that:
| virtual void SetID(const int NewID){ ID = NewID; }
|
Would be like telling the compiler "hey, not a pointer, but I won't be changing this value at ALL bro.. just reference the value in memory and don't create a useless variable please" or something like that. Probably doesn't matter either way but what can I say.. I ask newbish things.
I understood the purpose for using "const" with pointers but you've helped me clear things up.
Thanks fellas!