locked
c++/cx WinRT components inheritance

    Question

  • Hello,

    I'm trying to develop separated winrt components which will be placed in A.dll, and then extend them through inheritance in B.dll using c++/cx. Is it possible to do so?

    I can't find any information is it possible, but compiler says that constructor of base component is private (to make winrt component public I've to seal it, or place constructor in private modifier, which will exclude it from metadata).

    So my question: does winrt support inheritance of winrt components? If not, what will be the best solution to develop some base code for winrt components library?

    Thanks.


    • Edited by IEndGame Friday, June 8, 2012 2:49 PM
    Friday, June 8, 2012 1:09 PM

Answers

  • Under WinRT, inheritance is only supported for Xaml classes. This is a design decision they made early on.

    So you'd have to take a different design approach.


    http://blog.voidnish.com

    • Marked as answer by Jesse Jiang Monday, June 11, 2012 10:52 AM
    Friday, June 8, 2012 2:40 PM

All replies

  • Under WinRT, inheritance is only supported for Xaml classes. This is a design decision they made early on.

    So you'd have to take a different design approach.


    http://blog.voidnish.com

    • Marked as answer by Jesse Jiang Monday, June 11, 2012 10:52 AM
    Friday, June 8, 2012 2:40 PM
  • Thanks for answer
    Monday, June 11, 2012 10:49 AM
  • "So you'd have to take a different design approach."

    Such as...?

    Tuesday, March 25, 2014 5:18 PM
  • Such as not using WinRT classes for your code, and instead using traditional C++ classes. You can then wrap your final interface in a WinRT class.
    Wednesday, March 26, 2014 9:17 PM