Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- #include <string>
- using namespace std;
- class osoba{
- public:
- string imie, nazwisko;
- osoba(){
- imie="puste";
- nazwisko="puste";
- }
- osoba (string a, string b){
- imie=a;
- nazwisko=b;
- }
- ~osoba(){}
- string w_imie(){
- return imie;
- }
- string w_nazwisko(){
- return nazwisko;
- }
- };
- class student : public osoba {
- public:
- int ocena1, ocena2;
- student(){
- osoba();
- ocena1=0;
- ocena2=0;
- }
- student (string x, string y, int a, int b){
- osoba(x,y);
- ocena1=a;
- ocena2=b;
- }
- ~student(){}
- int w_ocena1(){
- return ocena1;
- }
- int w_ocena2(){
- return ocena2;
- }
- };
- class studium : public student {
- public:
- string nazwa;
- int rok;
- studium(){
- student();
- nazwa="puste";
- rok=0;
- }
- studium (string x, string y, int c, int d, string n, int a){
- student(x,y,c,d);
- nazwa=n;
- rok=a;
- }
- ~studium(){}
- string w_nazwa(){
- return nazwa;
- }
- int w_rok(){
- return rok;
- }
- };
- int main(){
- osoba os1("Jan","Kowalski");
- osoba os2("Tomasz","Nowak");
- student st1("Tata", "Muminka", 3, 3);
- student st2("Mama", "Muminka", 5, 4);
- studium stud1("Szymon", "Infobot", 6, 6, "Bocenie++", 2010);
- studium stud2("Wrona", "Gapa", 2, 2, "Ornitologia", 2005);
- cout << "Imie, Nazwiko, Ocena1, Ocena2, Kierunek, Rok" << endl;
- cout << os1.w_imie() << endl;
- cout << st1.w_imie() << endl;
- cout << stud2.w_imie() << " " << stud2.w_nazwisko() << " " << stud2.w_ocena1() << " " << stud2.w_ocena2() << " " << stud2.w_nazwa() << " " << stud2.w_rok() << endl;
- stud1.studium::~studium();
- stud2.studium::~studium();
- st1.student::~student();
- st2.student::~student();
- os1.osoba::~osoba();
- os2.osoba::~osoba();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement