Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.2 kB
1
Indexable
Never

#include <iostream>
#include <string>

using namespace std;

class Makina {
public:
    string marka;
    int viti_prodhimit;
    string shasia;
    string ngjyra;

    Makina(string m, int v, string sh, string n) {
        marka = m;
        viti_prodhimit = v;
        shasia = sh;
        ngjyra = n;
    }

    void ndrysho_vitin(int viti_ri) {
        viti_prodhimit = viti_ri;
    }

    virtual void afisho_marken_ngjyren() {
        cout << "Marka e makines eshte " << marka << " dhe ngjyra eshte " << ngjyra << endl;
    }
};

class Benz : public Makina {
public:
    string seria_benz;
    string vendprodhimi_benz;

    Benz(string m, int v, string sh, string n, string seria, string vendprodhimi)
        : Makina(m, v, sh, n) {
        seria_benz = seria;
        vendprodhimi_benz = vendprodhimi;
    }

    void ndrysho_serine(string seria_re) {
        seria_benz = seria_re;
    }

    void ndrysho_vitin_vendin(int viti_ri, string vendi_ri) {
        viti_prodhimit = viti_ri;
        vendprodhimi_benz = vendi_ri;
    }
};

int main() {
    Benz b1("Mercedez Benz", 2010, "A400XB", "e zeze", "S-Class", "Turqi");
    b1.ndrysho_vitin_vendin(2020, "Gjermani");
    b1.afisho_marken_ngjyren();
    return 0;
}
Leave a Comment