Don't forget the trailing semi-colon after your class definitions.
The definition of a class is essentially an explanation to the compiler of what to make when you create an instance of that class.
You
define the class, like this for example:
1 2 3 4 5
|
class someClass
{
int a;
double b;
}
|
The compiler see this, and now knows that there is a new type, named a someClass, and it contains an int called a and a double called b. You have not created an object; just explained to the compiler
how to make one.
Now, you can create objects of type someClass like this:
1 2
|
someClass instance01;
someClass instance02;
|
When you write this:
1 2 3 4 5
|
class secondClass
{
b;
};
|
you are saying there is this new kind of object, and we're going to call this new kind of object an object of type secondClass, and then you're saying it contains a 'b'.
The compiler has no idea what an object of type 'b' is. The error I get is:
ISO C++ forbids declaration of ‘b’ with no type |
This explains how to define and than create an instance of a class:
http://www.cplusplus.com/doc/tutorial/classes/
Out of interest, are you a Java coder?