Then either it's a "C" book, or it's one of those that finds it convenient to treat structs and classes differently even though they're almost the same thing. I guarantee it'll talk about constructors when you get to classes....
The book is a C++ book. Although it does talk about constructor use in classes they are not mentioned in the "structured data" chapter which is where structs are introduced. I found it very weird that the book did not mention anything about setting "default" values for structs. So i had to ask about it.
structs and classes are essentially the same thing. The only difference between them is default member/inheritance is public for structs and private for classes.
Code:
class A {};
class B : A // private inheritance
{
int b; // private
};
struct C {};
struct D : C // public inheritance
{
int d; // public
};
Other than that there is afaik no differences between structs and classes.
Get Microsoft Visual C++ Express here or CodeBlocks here.
Get STLFilt here to radically improve error messages when using the STL.
Get these two can't live without C++ libraries, BOOST here and Loki here.
Check your code with the Comeau Compiler and FlexeLint for standards compliance and some subtle errors.
Always use [code] code tags [/code] to make code legible and preserve indentation.
Do not ask for help writing destructive software such as viruses, gamehacks, keyloggers and the suchlike.
Bookmarks