JLospinoso / ccc

Companion Code for C++ Crash Course

Home Page:https://ccc.codes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Page 83, type error in constructor

dacharyc opened this issue · comments

In the Fourth Printing, the Member Initializer Lists example on p. 83 has a type error in the constructor.

struct Avout {
    Avout(const char* name, long year_of_apert)
        :  name{ name }, apert{ year_of_apert } {
    }
    void announce() const {
        printf("My name is %s and my next apert is %d.\n", name, apert.get_year());
    }
    const char* name;
    ClockOfTheLongNow apert;
};

The constructor has us initializing year_of_apert as a long, but ClockOfTheLongNow needs an int. The code example in this repo correctly has this as an int, but I haven't been able to find an errata or typo correction mentioning the error in the printed edition.

Thank you!