Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- using namespace std;
- class Zivotno {
- private:
- char ime_na_zivotno[51];
- int tezina;
- public:
- Zivotno() {
- }
- Zivotno(char *i, int t) {
- strcpy(ime_na_zivotno, i);
- tezina = t;
- }
- ~Zivotno() {
- }
- char* get_ime_na_zivotno() {
- return ime_na_zivotno;
- }
- int get_tezine() {
- return tezina;
- }
- };
- class Mesojadni : public Zivotno {
- private:
- char vid_na_zivotno[51];
- bool dali_e_divo;
- public:
- Mesojadni() : Zivotno() {
- }
- Mesojadni(char *ime_na_zivotno, int tezina, char *vid, bool d) : Zivotno(ime_na_zivotno, tezina) {
- strcpy(vid_na_zivotno, vid);
- dali_e_divo = d;
- }
- char* get_vid() {
- return vid_na_zivotno;
- }
- bool get_divo() {
- return dali_e_divo;
- }
- };
- int main() {
- Mesojadni kuce("lusi", 30, "kuce", false);
- cout << kuce.get_ime_na_zivotno() << " " << kuce.get_tezine() << " " << kuce.get_vid() << " " << kuce.get_divo() << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement