CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
Why is Encapsulation so importand in OOP? Here is my Answer.
*/
#include <iostream>
#include <string>
using namespace std;
class user {
protected:
string name;
string password;
int trys;
public:
user (string n, string pw) {
name = n;
password = pw;
trys = 0;
cout << "New User '" << name << "' with Password '" << password << "' created.\n";
cout << name << " has " << 3 - trys << " Chances to input the correct Password.\n";
}
string get_name() {
return name;
}
bool test_pw (string pw) {
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run