Advertisement
Guest User

Untitled

a guest
Apr 6th, 2020
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.28 KB | None | 0 0
  1.  
  2. #include <iostream>
  3.  
  4. template<unsigned Extent>
  5. struct Feeling {
  6.     virtual void ExpressFeelingToVioletta() const = 0;
  7. };
  8.  
  9. struct Love : public Feeling<100>  {
  10.     void ExpressFeelingToVioletta() const override final {
  11.         std::cout << "Violetta, I love you" << std::endl;
  12.     }
  13. };
  14.  
  15. struct Care : public Feeling<100> {
  16.     void ExpressFeelingToVioletta() const override final {
  17.         std::cout << "Violetta, I wanna care of you" << std::endl;
  18.     }
  19. };
  20.  
  21. struct Support : public Feeling<100> {
  22.     void ExpressFeelingToVioletta() const override final {
  23.         std::cout << "Violetta, I wanna always support you" << std::endl;
  24.     }
  25. };
  26.  
  27. struct Admiration : public Feeling<100> {
  28.     void ExpressFeelingToVioletta() const override final {
  29.         std::cout << "Violetta, i think you are the best girl for me" << std::endl;
  30.     }
  31. };
  32.  
  33.  
  34. struct Danil {
  35.     template<typename... Feelings>
  36.     static void LoveVioletta(Feelings&&... feelings) {
  37.         (feelings.ExpressFeelingToVioletta(), ...);
  38.     }
  39. };
  40.  
  41. struct Violetta {
  42.     static void NotLoveDanil() {
  43.         std::cout << "Danil, sorry, i don't like you" << std::endl;
  44.     }
  45. };
  46.  
  47.  
  48. int main () {
  49.  
  50.     Danil::LoveVioletta(Love{}, Care{}, Support{}, Admiration{});
  51.     Violetta::NotLoveDanil();
  52.  
  53.     return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement