listings-Chap15-README.md
Listings of Chap15.docx
This is linked summary of the listings. You can also view it on one page.
- Listing 15.1: The common ancestor of our “Year”, “Month”, and “Day” helper classes.
- Book: lst-0005-book.cpp
- Godbolt: lst-0005-godb.cpp, https://godbolt.org/z/hhGo46z5a
- Listing 15.2: The duplicate code of the helper classes has now disappeared.
- Book: lst-0006-book.cpp
- Godbolt: lst-0006-godb.cpp, https://godbolt.org/z/eYY1js4Te
- Listing 15.3: This is how ‘Date’ uses the new classes.
- Book: lst-0007-book.cpp
- Godbolt: lst-0007-godb.cpp, https://godbolt.org/z/9rY7qhK89
- Listing 15.4: Now “easter” is a method of “Year”.
- Book: lst-0008-book.cpp
- Godbolt: lst-0008-godb.cpp, https://godbolt.org/z/zqKvMedz7
- Listing 15.5: All components have a white color; only the button will be gray.
- Book: lst-0009-book.cpp
- Listing 15.6: What does “print” output? The “value” method appears more often.
- Book: lst-0010-book.cpp
- Godbolt: lst-0010-godb.cpp, https://godbolt.org/z/YTK8PfcMc
- Listing 15.7: Methods marked with “virtual” are resolved at runtime.
- Book: lst-0011-book.cpp
- Godbolt: lst-0011-godb.cpp, https://godbolt.org/z/vW5s3Kh6M
- Listing 15.8: The derived class inherits methods but not constructors from the parent class.
- Book: lst-0013-book.cpp
- Godbolt: lst-0013-godb.cpp, https://godbolt.org/z/59WKfxenE
- Listing 15.9: Using “using” to import all parent class constructors.
- Book: lst-0014-book.cpp
- Godbolt: lst-0014-godb.cpp, https://godbolt.org/z/h15eGahjh
- Listing 15.10: Passing by value only copies the common part of the type.
- Book: lst-0015-book.cpp
- Godbolt: lst-0015-godb.cpp, https://godbolt.org/z/Ec7vqEdY3
- Listing 15.11: The derived class as an argument type to a function does not allow calling with a base class variable as a value parameter.
- Book: lst-0016-book.cpp
- Godbolt: lst-0016-godb.cpp, https://godbolt.org/z/17nah59eP
- Listing 15.12: Passing by reference does not change the instance.
- Book: lst-0017-book.cpp
- Godbolt: lst-0017-godb.cpp, https://godbolt.org/z/sW7MexWrh