Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication1.cpp : Ten plik zawiera funkcję „main”. W nim rozpoczyna się i kończy wykonywanie programu.
- //
- #include <iostream>
- #include <string>;
- using namespace std;
- class Human {
- public:
- string name;
- int age;
- virtual void im() {};
- };
- class Child : public Human {
- public:
- void im() {
- cout << "Jestem dzieckiem. Moje imie to " << name << " Wiek to " << age << endl;
- }
- };
- class Daddy : public Human {
- public:
- void im() {
- cout << "Jestem dorosłym. Moje imie to " << name << " Wiek to " << age << endl;
- }
- };
- int main()
- {
- Child c;
- c.age = 15;
- c.name = "Tomek";
- c.im();
- Daddy d;
- d.age = 30;
- d.name = "Mariusz";
- d.im();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement