Class Types

In this lesson, we will explore some of the properties of classes.

Definition

Classes are data types encapsulating attributes and methods

C++ has several primitive classes such as integer, string, double, etc. Each type has its own methods that allow us to perform certain operations.

For example, the length() method can be used to calculate the length of a string.

In C++, we can create custom class types using the built-in types and defining our own methods.

Classes are quite similar to structs. For the purpose of this course, we will stick to classes.

Here is an example of a class:

class Account{
    public:
        Account(double b);
        void deposit(double amt);
        void withdraw(double amt);
        double getBalance() const;
   
...