locked
How to inherit from class object?

    Question

  • If I want to define a derived class inheriting from object?what can I do?And are there some intefaces that must be implemented?
    Friday, April 13, 2012 9:59 AM

Answers

  • I'm sorry. I should have expounded more in my post. All types, including user-defined types like custom classes, inherit from Platform::Object.

    So, in order to inherit from object, you simply need to define a new class and instantiate it somewhere in code. You don't need to explicitly inherit Platform::Object in your class, because the runtime does this for you.

    • Marked as answer by cybupt Tuesday, April 24, 2012 5:59 AM
    Monday, April 16, 2012 12:58 PM

All replies

  • All types in WinRT automatically derive from Platform::Object, so there is no need for you to inherit it explicitly.
    Sunday, April 15, 2012 2:33 AM
  • But I want to define some my own class inheritted from object .
    Monday, April 16, 2012 1:36 AM
  • I'm sorry. I should have expounded more in my post. All types, including user-defined types like custom classes, inherit from Platform::Object.

    So, in order to inherit from object, you simply need to define a new class and instantiate it somewhere in code. You don't need to explicitly inherit Platform::Object in your class, because the runtime does this for you.

    • Marked as answer by cybupt Tuesday, April 24, 2012 5:59 AM
    Monday, April 16, 2012 12:58 PM
  • thanks!
    Tuesday, April 17, 2012 2:51 AM