#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstring>
using namespace std;
class Person {
protected:
int height;
int weight;
string gender;
string personality;
string dream;
public:
Person() {}
Person(int h, int w, string g) : height(h), weight(w), gender(g) {
}
void makePersonality(string personality) {
this->personality = personality;
cout << "내성격은" << this->personality << endl;
}
void makeDream(string dream) {
this->dream = dream;
cout << "내 꿈은" << this->dream << endl;
}
void showPerson() {
cout << "안녕하세요! 저의 성별은" << gender << "이구요!" << endl;
cout << "저의 키는 " << height << " ,저의 몸무게는" << weight << "입니다" << endl;
}
};
class myClass : public Person {
private:
char name[20];
string music;
public:
myClass() {};
myClass(int h, int w, string g, const char* name) : Person(h, w, g) {
strcpy(this->name, name);
}
void favoriteMusic(string music) {
cout << "좋아하는 음악은 " << music << "입니다." << endl;
}
void showMyname() {
cout << "제 이름은 " << name << "입니다." << endl;
}
};
int main() {
myClass hm(175, 67, "남자", "조현민");
hm.showPerson();
hm.showMyname();
hm.makeDream(" 게임 개발자입니다.");
hm.makePersonality(" 긍정적입니다.");
hm.favoriteMusic("힙합");
}