Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. class Osoba {
  5. char * _imePrezime;
  6. public:
  7. Osoba(const char * imePrezime) {
  8. _imePrezime = new char[strlen(imePrezime) + 1];
  9. strcpy_s(_imePrezime, strlen(imePrezime) + 1, imePrezime);
  10. }
  11. virtual ~Osoba() = 0 {
  12. delete[]_imePrezime;
  13. _imePrezime = nullptr;
  14. }
  15. };
  16.  
  17. class Student:public Osoba {
  18. int _index;
  19. public:
  20. Student(const char * imePrezime, int index):Osoba(imePrezime) {
  21. _index = index;
  22. }
  23. };
  24.  
  25. void main() {
  26. /*Osoba Almedin("Almedin");*/
  27. Osoba * osoba = new Student("Alemdin", 19292929);
  28.  
  29. Student Faris("Faris", 150150);
  30. system("pause>0");
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement