Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class Human {
- public:
- string name;
- string surname;
- int age;
- Human (string a, string b){
- name = a;
- surname= b;
- }
- void Hello(){
- cout << "Hello my name is "<<name << " "<< surname<< endl;
- }
- Human (int x){
- age=x;
- }
- void Years(){
- cout << age <<"years old"<< endl;
- }
- };
- int main()
- {
- Human a= Human("Sergey","Trukhachev");
- a.Hello();
- Human b= Human(18);
- b.Years();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement