Untitled

mail@pastecode.io avatar
unknown
c_cpp
a month ago
1.3 kB
1
Indexable
Never
#include <iostream>
#include <string>
using namespace std;

class Makina {
public:
    int viti_prodhimit;
    string marka;
    string shasia;
    string ngjyra;
    
    void ndrysho_vitin(int viti2) {
        viti_prodhimit = viti2;
    }
    
    void afisho_marken_ngjyren() {
        cout << "Marka eshte " << marka << ", dhe ngjyra eshte " << ngjyra << endl;
    }
    
    Makina(int v, string m, string sh, string n) {
        viti_prodhimit = v;
        marka = m;
        shasia = sh;
        ngjyra = n;
    }
};

class Benz : public Makina {
private:
    string seria_benz;
    string vend_prodhimi_benz;

public:
    Benz(int v, string m, string sh, string n, string sB, string vpB) : Makina(v, m, sh, n) {
        seria_benz = sB;
        vend_prodhimi_benz = vpB;
    }

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

    void ndrysho_vitin_vendin(int vitiB, string vendiB) {
        viti_prodhimit = vitiB;
        vend_prodhimi_benz = vendiB;
    }
};

int main() {
    Benz b1(2010, "Mercedes Benz", "AYH6388JW", "E Zeze", "S-Class", "Gjermani");
    b1.ndrysho_vitin_vendin(2020, "Turqi");
    b1.afisho_marken_ngjyren(); // This line will print the updated values
    return 0;
}
Leave a Comment