Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- template<unsigned Extent>
- struct Feeling {
- virtual void ExpressFeelingToVioletta() const = 0;
- };
- struct Love : public Feeling<100> {
- void ExpressFeelingToVioletta() const override final {
- std::cout << "Violetta, I love you" << std::endl;
- }
- };
- struct Care : public Feeling<100> {
- void ExpressFeelingToVioletta() const override final {
- std::cout << "Violetta, I wanna care of you" << std::endl;
- }
- };
- struct Support : public Feeling<100> {
- void ExpressFeelingToVioletta() const override final {
- std::cout << "Violetta, I wanna always support you" << std::endl;
- }
- };
- struct Admiration : public Feeling<100> {
- void ExpressFeelingToVioletta() const override final {
- std::cout << "Violetta, i think you are the best girl for me" << std::endl;
- }
- };
- struct Danil {
- template<typename... Feelings>
- static void LoveVioletta(Feelings&&... feelings) {
- (feelings.ExpressFeelingToVioletta(), ...);
- }
- };
- struct Violetta {
- static void NotLoveDanil() {
- std::cout << "Danil, sorry, i don't like you" << std::endl;
- }
- };
- int main () {
- Danil::LoveVioletta(Love{}, Care{}, Support{}, Admiration{});
- Violetta::NotLoveDanil();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement