Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
1.7 kB
2
Indexable
/*                   الـلـهـم انـي أبـرأ مـن حـولـي وقـوتـي وألـتـجـئ الـي حـولك وقـوتـك
♡ ♡ ♡ اللـهـم أعـنـي ولا تـعـن عـلـي وانـصـرنـي ولا تـنـصـر عـلـي واهـدنـي ويـسـر الـهـدي لـي ♡ ♡ ♡
*/
#include <bits/stdc++.h>
using namespace std;
// #define int long long
#define pi 3.14159265358979323
#define all(v) v.begin() , v.end() // samuria - codeStriker - Trojan
#define rall(v) v.rbegin(),v.rend()

class Creature {
    int Height;
    void Die() {
        cout << "mat y 3aini\n";
    }

protected:
    int Weight;

public:
    int Age;
    Creature(int age) : Age(age) {}
    Creature(int age , int height) : Age(age) , Height(height) {}
    void Move() {
        cout << "Creatre is moving.....\n";
    }
};
class Human : public Creature{
public:
    int ID;
    Human() : Creature(10) {
        Weight = 20;
        // Move();
        // Creature::Move();
    }
    Human(int age, int weight) : Creature(age) {
        Weight = weight;
    }
    void Think() {
        cout << "human is thinking....\n";

    }
    // void Move() {
    //     cout << "Human is moving....\n";
    // }
};

void solve() {
    Human h;
    Creature *ptr = &h;
    cout << ptr->Age << '\n';
    ptr->Move();

    Human h2 = (Human)(*ptr);

}

int32_t main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    std::ios::sync_with_stdio(false);
    ios_base::sync_with_stdio(false);
    cout.tie(nullptr);
    cin.tie(nullptr);
    int t = 1; //cin >> t;
    while (t--)solve();
}
Leave a Comment