File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // the number and the position of access specifiers is not certain.
2+ // the members which you want to access at everywhere after the definition should be put after the public specifier.
3+ // the members which you want to access only at the class should be put after the private specifier.
Original file line number Diff line number Diff line change 1+ // The only difference between struct and class is the default access level.
2+ // struct: public
3+ // class: private
Original file line number Diff line number Diff line change 1+ // Encapsulation: the separation of implementation from interface. It hides the implementation details of a type.
Original file line number Diff line number Diff line change 1+ // class Person
2+ // {
3+ // public://the interface should be public
4+ // Person() = default;
5+ // Person(const string &s1, const string &s2) : name(s1), name(s2) { }
6+ // Person(std::istream &is)
7+ // {
8+ // read(is, *this);
9+ // }
10+
11+ // string getName() const { return name; }
12+ // string getAddress() const { return address; }
13+
14+ // private://the data should be private
15+ // string name;
16+ // string address;
17+ // };
You can’t perform that action at this time.
0 commit comments