Classes in C++ - Reading Assignment

1. Why do we need classes, why can't we just use structs?

Structs are typically used to hold data only, although structs may contain functions. Classes provide a way to hold data and functions that work with the data as well. Data only structs need the functions to be defined separately. Classes will also dealocate memory after being destroyed, which increases performance, you may not assume this using a struct.

2. What are methods?

Methods or member functions are functions inside a class that use the data inside the class.

3. How would you define a class?

First declare the class

class DateClass
    int m_year;
    int m_month;
    int m_day;

then declare the variables of the class using the known method:
DateClass today { 2020, 10, 14 };

4. What is an object?

An object is a variable of a class type, also called an instance