Skip to Content
C++20 for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners
book

C++20 for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners

by Will Briggs
December 2020
Beginner to intermediate
681 pages
11h 20m
English
Apress
Content preview from C++20 for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners
© Will Briggs 2021
W. BriggsC++20 for Lazy Programmershttps://doi.org/10.1007/978-1-4842-6306-8_15

15. Classes

Will Briggs1  
(1)
Lynchburg, VA, USA
 

Till now, what we’ve covered has been essentially C with a few tweaks, notably cin and cout. Now it’s time to add the thing that puts the + in C++: classes. They won’t give us new abilities like cin/cout, SSDL functions, or control structures like loops. What they will do is help us keep things organized so we don’t get confused; minimize errors; and make expressing things simpler – so we can trust the code we write and use it for bigger and better projects.

As an example, here’s a class type to store a calendar date:
class Date
{
    int day_;
    int month_;
    int year_;
};
...
Date appointment; // Variables ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C++ for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners

C++ for Lazy Programmers: Quick, Easy, and Fun C++ for Beginners

Will Briggs

Publisher Resources

ISBN: 9781484263068Purchase LinkPublisher Website