Skip to content

Instantly share code, notes, and snippets.

@GarryMoveOut
Last active January 1, 2016 09:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GarryMoveOut/58e2d0550fb387c977b7 to your computer and use it in GitHub Desktop.
Save GarryMoveOut/58e2d0550fb387c977b7 to your computer and use it in GitHub Desktop.
#include "baza.h"
baza::baza(int _zycie, string _opis)
:zycie(_zycie)
,opis(_opis)
{
zycie = _zycie;
opis = _opis;
}
baza::~baza(void)
{
}
#pragma once
#include <string>
using namespace std;
class baza
{
public:
int zycie;
string opis;
baza(int _zycie, string _opis);
~baza(void);
};
#include "gracze.h"
gracze::gracze(int _z, string _o, int _atak, string _okrzyk)
:baza(_z, _o)
,atak(_atak)
,okrzyk(_okrzyk)
{
atak = _atak;
okrzyk = _okrzyk;
}
gracze::~gracze(void)
{
}
int gracze::pokaz_zycie()
{
return zycie;
}
string gracze::krzyki()
{
return okrzyk;
}
#pragma once
#include "baza.h"
#include <string>
class gracze:
public baza
{
public:
int atak;
string okrzyk;
//int zycie;
//string opis;
gracze(int _zycie, string _opis, int _atak, string _okrzyk);
~gracze(void);
int pokaz_zycie(); //metoda zwracajaca zycie
string krzyki(); //metoda zwracajaca okrzyk
};
#include "przeszkody.h"
przeszkody::przeszkody(int _opor, int _wielkosc)
:baza(zycie, opis)
{
opor = _opor;
wielkosc = _wielkosc;
}
przeszkody::~przeszkody(void)
{
}
#pragma once
#include "baza.h"
class przeszkody
:public baza
{
public:
int opor;
int wielkosc;
przeszkody(int _opor, int _wielkosc);
~przeszkody(void);
};
#include <iostream>
#include <string>
using namespace std;
//nagłówki klas
#include "baza.h"
#include "gracze.h"
#include "przeszkody.h"
int main()
{
baza player1(100,"gracz1");
cout<<"player zycie"<<endl;
cout<<player1.zycie<<endl;
//utworzenie gracza
gracze gracz(90, "foo", 10, "hurra");
cout<<"gracz zycie wartosc"<<endl;
cout<<gracz.zycie<<endl;
cout<<"player zycie"<<endl;
cout<<player1.zycie<<endl;
cout<<"player opis"<<endl;
cout<<player1.opis<<endl;
cout<<"gracz opis"<<endl;
cout<<gracz.opis<<endl;
cout<<"gracz ataak"<<endl;
cout<<gracz.atak<<endl;
cout<<"gracz okrzyk"<<endl;
cout<<gracz.okrzyk<<endl;
system("Pause");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment