#include <iostream> using namespace std; class Person{ private: int walkingDistance; int speed; public: Person(); Person(int parameter); int walk(); int powerWalk(int speed); void print(); }; int main() { Person A; Person B=Person(10); int i; for(i=0;i<10;i++){ A.powerWalk(3); A.walk(); B.walk(); } A.print(); B.print(); return 0; } Person::Person() //default 생성자. { walkingDistance=100; speed=1; } Person::Person(int parameter) { walkingDistance=parameter; speed=1; } int Person::walk() { walkingDistance += speed*10; return 0; } int Person::powerWalk(int speed) { walkingDistance+=speed*10; return 0; } void Person::print() { cout<<walkingDistance<<endl; }