Page 1 of 1

API and/or C++ question

Posted: Mon Dec 19, 2005 4:31 pm
by Hacim
I kind of new to this OOP part of C++ so maybe I'm just missing some thing,
but here is my problem: I want to make of subclass of ICameraSceneNode
but that class is abstract or whatever (something todo with pure virtual functions) so I thought there must already be a sub class of ICameraSceneNode,therefore I looked in the source code (I didn't not compile it) and found CCameraSceneNode wich seem to be just what I wad looking for except when I tried to use it in my program it did not seem to exist.
Do I have to include that file?I think that highly unlikely.Does any one no what I'm saying?
Thanks

Posted: Mon Dec 19, 2005 7:48 pm
by Guest
This has to do with the architecture of C++ DLLs - the CCameraSceneNode is just the implementation in the DLL and its using the ICameraSceneNode (called the (I)nterface) so you can use it outside the DLL. So you know the ICameraSceneNode and you can request data which is derived from that interface without knowing the class type.

You have to use ISceneManager::addCamera (in different variations) and get a working CCameraSceneNode.

check google some OOP knowledge wont hurt when working with irrlicht.

Posted: Tue Dec 20, 2005 7:16 pm
by Hacim
Oh I think I get it.So there is really no easy way to create a sub class of any of the Interface classes without overiding every pure virtual function in the super class?(which would be a bit of work for the larger classes like ICameraSceneNode.)I could still work around that by just havine a pointer to it in a costom class but that would, be as clean.Oh well.

thanks for your help.

Posted: Tue Dec 20, 2005 11:29 pm
by pfo
So there is really no easy way to create a sub class of any of the Interface classes without overiding every pure virtual function in the super class?
That's right, but the point of making a class with many pure virtual functions is specifically so that class can be used by many classes that derive from it and share its functionality, but by itself the class is useless. One thing you might try doing is make a class, keep an ICameraSceneNode pointer in it and manipulate it there. A camera class make sense to be stored with a player controller or something similar

Posted: Wed Dec 21, 2005 3:17 pm
by Hacim
Alright that's what I'll do, thanks everybody.