Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C++ by registered user 110010019 ( 4 years ago )
#include <string>
#include <iostream>
using namespace std;

class Human{
    public:
    Human(string name, int age): Name(name), Age(age){}

    void Introduce(){
        cout<<"Introduce in base class(Human)\n";
    }

    protected:
        string Name;
        int Age;
};

class Engineer : public Human{
public:
    Engineer(string name, int age): Human(name, age){}

    void Intruducce(){
        cout<<"Engineer selfintroduction\n";
    }

    virtual void WriteCode(){cout << "Coding..." << endl;}
};

class Poorgramer : public Engineer{
public:
    Poorgramer(string name, int age): Engineer(name, age){}

    // void Introduce(){
    //     cout<<"poorgrammer selfintroduction\n";
    // }
};

int main(){
    Poorgramer Mike("Mike", 18);
    Mike.Introduce();
    Mike.WriteCode();
    return 0;
}

 

Revise this Paste

Your Name: Code Language: