[MS] C++/WinRT implementation inheritance: Notes on winrt::implements, part 4 - devamazonaws.blogspot.com
Last time, we figured out the rules for inheriting winrt:: implements in C++/WinRT runtime class implementations : You can use winrt:: implements in your class hierarchy, as long as you use single inheritance for the winrt:: implements part. You are not allowed to derive multiply from two different winrt:: implements base classes. One case of this is a base class that is configured at construction. struct StringableInt32 : winrt::implements<StringableInt32, winrt::Windows::Foundation::IStringable> { StringableInt32(int value) : m_value(value) {} winrt::hstring ToString() { return winrt::to_hstring(m_value); } private: int m_value; }; We can use this by itself: auto o = winrt::make<StringableInt32>(42); But we can also tell the implements template that we would like to derive from it. struct Derived : winrt::implements<Derived, StringableInt32> { Derived() : StringableInt32(42) {} }; Unfortunately, this doesn't work...