I have a class ClassA implement interface IFooBar like below
class ClassA : public Microsoft::WRL::RuntimeClass<IFooBar>
{
public:
virtual HRESULT RuntimeClassInitialize(ParamsForClassA);
}
Now I want to write a ClassB inherent ClassA and override it's RuntimeClassInitialize function like below:
class ClassB : public ClassA
{
public:
HRESULT RuntimeClassInitialize(ParamsForClassB)
{
// implementation goes here
}
}
And I create a pointer to ClassB object like this:
ComPtr<ClassB> ptr;
HRESULT hr = MakeAndInitialize<ClassB>(&ptr, ParamsForClassB);
But this actually goes to ClassA's RuntimeClassInitialize constructor. The ClassB's RuntimeClassInitialize code path is never hit.
I am wondering if this is the correct way of extending class in WRL? Where am I doing wrong in the code?