posted
Anyone know and good sites about C++ esp about classes, and header files? I'm on my last assignment. Thanks.
Posts: 1567 | Registered: Oct 2004
| IP: Logged |
posted
"Anyone know and good sites about C++ esp about classes, and header files? I'm on my last assignment."
Um. If this is your last assignment for C++, why are you only now getting an introduction to classes and header files?
Posts: 37449 | Registered: May 1999
| IP: Logged |
posted
I don't know if it will help you, but this was at the top of the list when I typed "C++" into google. It looks decent.
Posts: 2149 | Registered: Aug 2000
| IP: Logged |
posted
umm... I understand everything ELSE but header and classes I haven't grasped yet, my project is to recreate the game of Othello.
Posts: 1567 | Registered: Oct 2004
| IP: Logged |
posted
Header file are much simpler than they're often made out to be. Really, just write your class defenitions in one file with a dot 'h' extention, then in your main file (.cpp) along with statments like #include <iostream> and #include <stdlib> just write #include "MyHeaderFile.h". Then you can use those class defenitions in your main file.
(This is not the only thing that can be done with headers but it's probably all you need to know)
posted
Do you understand what classes are, or do you just need to figure out how to use them? If the former, here's my best description of them:
Classes are blueprints of data structures that include sets of data (things like strings, integers, floats, even instances of other classes) and sets of instructions (functions). They allow you to abstract your program into self contained components that act or are acted upon, like objects in the real world (hence object-oriented programming being all the rage).
However, the class itself is like a Platonic Form; it is "perfectly" conceived, yet in reality is inert. What you do in your code is tell the computer to build an instance of the class (also called an object). This particular instance is the thing that is manipulated by the rest of your code.
posted
Headers are pretty simply, but classes aren't, or at least aren't as simple to learn. If you need to figure out both, concentrate on classes, headers will be a breeze after that.