Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <conio.h>
- using namespace std;
- class Osoba{
- protected:
- char ime,prezime,spol;
- public:
- Osoba(){
- ime='i';prezime='p';spol='m';
- }
- Osoba(char i,char p, char s){
- ime=i;prezime=p;spol=s;
- }
- void postavi_atribute_o (char i, char p, char s){
- ime=i;prezime=p;spol=s;
- }
- void ispisi_atribute_o (){
- cout<<ime<<prezime<<spol<<endl;
- }
- };
- class Ucenik :public Osoba{
- protected:
- char odjeljenje, ime_skole;
- int razred;
- public:
- Ucenik(){
- razred=1;odjeljenje='a';ime_skole='o';Osoba();
- }
- Ucenik(char i,char p, char s,int r,char o, char is){
- razred=r;odjeljenje=o;ime_skole=is;Osoba(i,p,s);
- }
- void postavi_atribute_u (int r, char o, char is,char i,char p,char s){
- postavi_atribute_o(i,p,s);razred=r;odjeljenje=o;ime_skole=is;
- }
- void ispisi_atribute_u (){
- ispisi_atribute_o ();
- cout<<razred<<odjeljenje<<ime_skole<<endl;
- }
- };
- class Student :public Osoba{
- protected:
- char fakultet;
- int semestar, broj_indeksa;
- public:
- Student(){
- fakultet='e';semestar=3;broj_indeksa=1200;Osoba();
- }
- Student(char i,char p, char s,char f,int se, int br ){
- Osoba(i,p,s);
- fakultet=f;semestar=se;broj_indeksa=br;
- }
- void postavi_atribute_s (char f,int se, int br,char i,char p,char s){
- postavi_atribute_o(i,p,s);fakultet=f;semestar=se;broj_indeksa=br;
- }
- void ispisi_atribute_s (){
- ispisi_atribute_o ();
- cout<<fakultet<<semestar<<broj_indeksa<<endl;
- }
- };
- int main()
- {
- Ucenik U1('i','p','m',5,'a','o');
- Student S1('i','p','m','e',6,100);
- U1.postavi_atribute_u('i','p','m',5,'a','o');
- S1.postavi_atribute_s('i','p','m','e',6,100);
- U1.ispisi_atribute_u();
- S1.ispisi_atribute_s();
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement