Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

More questions about inheritance

$
0
0
This is a continuation of my previous topic, I am still super confused Situation: There is this "D3DApp" class that is basically a framework to inherit from that give us a Window, a Renderer and a GameTimer. My class "Direct3D11Engine" derives from "D3DApp". This is how the autor of "3d Game Programming using DirectX11" suggest to initialize my Direct3D11Engine class: bool Direct3D11Engine::Init() { if (!D3DApp::Init()) { return false; } //Additional Initialization return true; } Now, from what I can tell something weird is happening, because the D3DApp::Init() method is called from inside my "Direct3D11Engine" fully constructed object. At a first glance I would assume that a D3DApp object instance was default constructed and it's Init() method called, but that is not the case at all because if it was that way, then that instance would have his own ImmediateContext and swapChain and so on and my derived class would just have a bunch of nullptr instead, but I've tried to draw from within my "Direct3D11Engine" Draw() function and everything works, so that call to D3DApp::Init() indeed got my class variable all setup. What on earth is going on here?!

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>