From 10ee772a1fcdf012bd84402b2d482135d3e2a114 Mon Sep 17 00:00:00 2001 From: Jidong Xiao Date: Thu, 7 Sep 2023 22:06:53 -0400 Subject: [PATCH] break the long line --- lectures/03_classes_I/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lectures/03_classes_I/README.md b/lectures/03_classes_I/README.md index 16b4fd3..3375aac 100644 --- a/lectures/03_classes_I/README.md +++ b/lectures/03_classes_I/README.md @@ -6,7 +6,7 @@ - [date_main.cpp](./date_main.cpp) - Class declaration: member variables and member functions; Using the class member functions; -- Member function implementation; Class scope; Classes vs. structs; Designing classes; +- Member function implementation; Class scope; Designing classes; - Defining a custom sort of class instances. ## 3.1 Types and Defining New Types @@ -133,7 +133,9 @@ sort(dates.begin(), dates.end(), earlier_date); Where earlier_date is a helper function we define in date.h and date.cpp that takes two const references to Date objects and returns true if and only if the first argument should be considered “less” than the second in the sorted order. ```cpp bool earlier_date (const Date& a, const Date& b) { - if (a.getYear() < b.getYear() || (a.getYear() == b.getYear() && a.getMonth() < b.getMonth()) || (a.getYear() == b.getYear() && a.getMonth() == b.getMonth() && a.getDay() < b.getDay())) + if (a.getYear() < b.getYear() || + (a.getYear() == b.getYear() && a.getMonth() < b.getMonth()) || + (a.getYear() == b.getYear() && a.getMonth() == b.getMonth() && a.getDay() < b.getDay())) return true; else return false;