Advertisement
Frumkin

Untitled

May 8th, 2021
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <functional>
  5. #include <cmath>
  6.  
  7. void Example1() {}
  8.  
  9. bool Example2() { return true; }
  10. bool* Example3() { return new bool(true); }
  11.  
  12. std::function<void()> Example4 = []() {};
  13. std::function<bool()> Example5 = []() { return true; };
  14. std::function<bool*()> Example6 = []() { return new bool(true); };
  15.  
  16. bool Example7(false);
  17. bool* Example7Pointer = &Example7;
  18.  
  19. const bool Example8(false);
  20. const bool* const Example8Pointer = &Example8;
  21.  
  22. class Textable {
  23. public:
  24. virtual std::string ToText();
  25. };
  26.  
  27. class Vector : public Textable {
  28. public:
  29. float X = 0.0f;
  30. float Y = 0.0f;
  31.  
  32. Vector(const float* x, const float* y) {
  33. X = *x;
  34. Y = *y;
  35. }
  36.  
  37. std::string ToText() {
  38. return "X: " + std::to_string(X) + ", Y: " + std::to_string(Y);
  39. }
  40. };
  41.  
  42. int main() {
  43. float x(2.4f);
  44. float y(8.7f);
  45.  
  46. Vector vector(&x, &y);
  47.  
  48. std::cout << vector.ToText() << std::endl;
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement