Headers, Libraries and the rest
Hi,
Just a quick question, I'm wondering about the way code should be stored in files as headers. For example:
I have a class, called Books for example. What extension should I give to the file that contains the definition, the declaration and the other stuff I left out.
This is what I normally do, but I'm not sure if its considered right:
books.HPP
Code:
#ifnef...
class Books
{
....
int CountBooks();
}
#endif
books.CPP
Code:
int Books::CountBooks()
...
Is that considered the proper way to do it? Also, which file includes which? I assume that the CPP file should #include the HPP file, but if I do it like that, and I have another CPP file that includes the HPP file, ie:
main.CPP
Code:
#include "books.HPP"
Books myBooks......
There is no way that books.CPP gets included.
If anyone can tell me whats considered the standard way of doing this I would be most grateful (and for C files as well, eg *.H and *.C)