MeehoweCK

Untitled

May 16th, 2020
1,379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. // main.cpp
  2. #include "head.h"
  3. #include "Klasa.h"
  4.  
  5. int main()
  6. {
  7.     funkcja();
  8.     inna_funkcja();
  9.     Klasa klasa;
  10.     klasa.wypisz_wartosc();
  11.     return 0;
  12. }
  13.  
  14. // head.h
  15. void funkcja();
  16. void inna_funkcja();
  17.  
  18. // funkcje.cpp
  19. #include <iostream>
  20.  
  21. using namespace std;
  22.  
  23. void funkcja()
  24. {
  25.     cout << "to jest wywolanie pierwszej funkcji\n";
  26. }
  27.  
  28. void inna_funkcja()
  29. {
  30.     cout << "to jest wywolanie jakiejs innej funkcji\n";
  31. }
  32.  
  33. // Klasa.h
  34. #ifndef KLASA_H
  35. #define KLASA_H
  36.  
  37.  
  38. class Klasa
  39. {
  40.     public:
  41.         Klasa();
  42.         void wypisz_wartosc();
  43.     protected:
  44.  
  45.     private:
  46.         int wartosc;
  47. };
  48.  
  49. #endif // KLASA_H
  50.  
  51. // Klasa.cpp
  52. #include <iostream>
  53. #include "Klasa.h"
  54.  
  55. using namespace std;
  56.  
  57. Klasa::Klasa()
  58. {
  59.     wartosc = 15;
  60. }
  61.  
  62. void Klasa::wypisz_wartosc()
  63. {
  64.     cout << "Wartoscia obiektu tej klasy jest " << wartosc << endl;
  65. }
Advertisement
Add Comment
Please, Sign In to add comment