Hi there!
I'm working through a demo application for my DX12 studying and I've come across this. There's a parent class and a child class, and the child class is simply declared as inheriting from the parent class, as it usually is.
However there's a weird extra line in there that to me seems to reference the parent class unnecessarily. Have a look:
Code:
class InitDirect3DApp : public D3DApp
{
public:
InitDirect3DApp(HINSTANCE hInstance);
~InitDirect3DApp();
...more stuff
};
So there's the class. Now take a look at its constructor:
Code:
InitDirect3DApp::InitDirect3DApp(HINSTANCE hInstance)
: D3DApp(hInstance)
{
...empty definition?
}
The part in bold : D3DApp(hInstance) seems unnecessary to me, in fact I don't even know what it's doing. I thought you simply declare a class as inheriting from another, and then write a specific constructor for it without having to reference its parent class at all in that definition.
Furthermore I don't understand why the definition is empty and yet still references the parent class. To be honest I don't even understand the syntax involved. How does: D3DApp(hInstance) at the end of the definition even get handled by the compiler?
I'm pretty stumped and would be glad of the help thanks