I ran into an error when trying to compile my code for exercise 6.1. I realized that a semicolon ( “;” ) is needed after the closing curly brace ( “}” ). This is shown in the longer code examples, but isn’t shown in the shorter ones. For example, in section 6.2.1 How to define a class in C++ the code example reads:
class Hobbit {
public:
string name;
float height; //in meters
int age;
void get_name() {
cout << "This hobbit's name is " << name << endl;
}
void convert_height_to_cm();
}
There is no “;” shown to finish the class definition. For the most basic example you then have:
class Hobbit {}
again without a semicolon. The snippet in section 6.2.3 has the same omission. Since the semicolon seems to be essential, I think you should include it in all of the code snippets so that it’s clear that the semicolon is essential.
/K