Simpe_Class
Alexmegawin
c_cpp
2 years ago
753 B
3
Indexable
#include <iostream> using namespace std; class child { private: string name, surname; int age; public: child() { cout << "who is he/she?\n"; } child(string name_, string surname_, int age_) { cout << "He/She is " << name_ << " " << surname_ << ". He/She is " << age_ << "yo.\n"; set_inf(name_,surname_,age_); } void set_inf(string name_,string surname_,int age_) { name = name_; surname = surname_; age = age_; } string get_inf() { return (name); return (surname); } int get_age() { return (age); } }; int main(){ cout << "output:\n"; child Unknown; child Aleksand_Rastorguev_15 = child("Aleksandr", "Rastorguev", 15); child Dmiriy_Apasov_15 = child("Dmitriy", "Apasov", 15); }
Editor is loading...