1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| #include<iostream> using namespace std; class Person { public: Person(int a, int b):m_a(a),m_b(b) {
} void PrintPerson() { cout << "A = " << m_a << " B = " << m_b << endl; } private: int m_a; int m_b; }; int main() { Person p(10, 20); p.PrintPerson(); return 0; }
|