From bf51cc9bf5c9f31177e073fc2c22d74c3256fe1e Mon Sep 17 00:00:00 2001 From: Jidong Xiao Date: Thu, 7 Sep 2023 20:58:38 -0400 Subject: [PATCH] more about C++ classes --- lectures/03_classes_I/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lectures/03_classes_I/README.md b/lectures/03_classes_I/README.md index 36d2b35..cc2642d 100644 --- a/lectures/03_classes_I/README.md +++ b/lectures/03_classes_I/README.md @@ -7,8 +7,21 @@ ## 3.1 Types and Defining New Types +- Every C++ object has a type (e.g., integers, doubles, strings, and vectors, etc., including custom types); and a class is a custom data type, also known as a user-defined data type. +– The type tells us what the data means and what operations can be performed on the data. + ## 3.2 C++ Classes +- A C++ class group together variables and functions that operate on those variables. We call these variables *member variables*, and we call these functions *member functions*. + +- A C++ class consists of + + – a collection of member variables, usually private, and + – a collection of member functions, usually public, which operate on these variables. + +- public member functions can be accessed directly from outside the class, +- private member functions and member variables can only be accessed indirectly from outside the class, through public member functions. + ## 3.3 Class scope notation ## 3.4 Constructors