title: How do I override IInspectable::GetRuntimeClassName() for a WinRT (ref) class
body: <p>According to the WinRT specification, private classes should override <a href="http://msdn.microsoft.com/en-us/library/br205823%28v=vs.85%29.aspx" rel="nofollow">IInspectable::GetRuntimeClassName()</a> and return a different name (or NULL). But since <code>IInspectable</code> isn't a ref class (it's a struct), I can't inherit from it, or override the methods.</p>
  
  <p>Define from MSDN:</p>
  
  <pre><code>HRESULT GetRuntimeClassName(
    [out]  HSTRING *className
  );
  </code></pre>
  
  <p>So the question is, how do I override <code>IInspectable::GetRuntimeClassName()</code> for a WinRT (ref) class?</p>
  
  <p>Sample attempt:</p>
  
  <pre><code>#include "Hstring.h"
  #include "Inspectable.h"
  #include &lt;sal.h&gt;
  
  namespace PhoneVoIPApp
  {
      namespace BackEnd
      {
          namespace CallController
          {
              public interface class IHelloWorld 
              {
                  Platform::String^ SayHello();
              };
  
              private ref class HelloWorldImpl sealed :IHelloWorld
              {
              public:
                  virtual Platform::String^ SayHello();
  
                  virtual HRESULT GetRuntimeClassName(_Out_ HSTRING *className) override;
              };
  
              Platform::String^ HelloWorldImpl::SayHello()
              {
                  return L"Hello World!";
              }
  
              HRESULT HelloWorldImpl::GetRuntimeClassName(_Out_ HSTRING *className)
              {
                  *className = nullptr;
  
                  return E_NOTIMPL;
              }
          }
      }
  }
  </code></pre>