Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. // Program do paliwa w klasach.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <stdio.h>
  7. using namespace std;
  8.  
  9. class Port
  10. {
  11. private:
  12. char * brand;
  13. char style[20]; // na przykład lekko brazowe, rubinowe, z najlepszego rocznika
  14. int bottles;
  15. public:
  16. Port(const char * br = "Brak", const char * st = "Brak", int b =0);
  17. Port(const Port & p); // konstruktor kopiujacy
  18. virtual ~Port() {delete [] brand;}
  19. Port & operator=(const Port & p);
  20. Port & operator+=(int b); // dodaje b do bottles
  21. Port & operator-=(int b); // odejmuje b od bottles, jesli operacja ta jest mozliwa
  22. int BottleCount() const {return bottles;}
  23. virtual void Show() const;
  24. friend ostream &operator<<(ostream & os, const Port & p);
  25. };
  26.  
  27.  
  28. class VintagePort : public Port
  29. {
  30. private:
  31. char * nickname;
  32. int year;
  33. public:
  34. VintagePort();
  35. VintagePort(const char *br, const char * st, int b, const char *nm, int Year);
  36. VintagePort(const VintagePort &vp);
  37. ~VintagePort() {delete [] nickname;}
  38. VintagePort & operator=(const VintagePort & vp);
  39. void Show() const;
  40. friend ostream & operator<<(ostream & os, const VintagePort &vp);
  41. };
  42. int _tmain(int argc, _TCHAR* argv[])
  43. {
  44. return 0;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement