Encapsulation

This lesson shows us how to implement the first component of data hiding: encapsulation.

We'll cover the following...

A Real Life Example

For the sake of explanation, we’ll start off by creating a simple movie class which contains three members:

Press + to interact
class Movie{
string title;
int year;
string genre;
public:
Movie(){
title = "";
year = -1;
genre = "";
}
Movie(string t, int y, string g){
title = t;
year = y;
genre = g;
}
};

There must be a way to ...