Jump to content
  • Advertisement
Sign in to follow this  
Preacher

C++ Single Inheritance Class Tree & other stuff

This topic is 4773 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi im just getting acquainted with c++, and i'm reasearching into developing a simple game engine to learn a bit about them. over the past week ive been swithcing my mind over from java to c++ and from looking at three game design architectures i see a lot of commonality between java single inheritance class tree and a lot of game archtectures: *all classes inherit from Object base class *Garbage Collection through smart pointers and reference counting *Run Time Type information *etc a lot of the archtectures ive looked at are pretty simular and i was wondering was there any standard library for c++ objects systems??? also im using visual studio 6 at the moment which is not clicking with me and i just hate its editor, this is coming from jedit which i love, so my second question is: is there any non clunky light weight c++ development ides out there that are 100% ansi c++ complient?? or have i hit the cream of the crop as far as C++ ides are concerned cos i really hope not.

Share this post


Link to post
Share on other sites
Advertisement
For smart pointers you can use boost::smart_ptr, in particular boost::shared_ptr and boost::weak_ptr which are on track to be standardized as std::tr1::shared_ptr and std::tr1::weak_ptr.

RTTI is supplied natively by C++ in the form of dynamic_cast and typeid operations.

Personally, I use MSVC .NET 2003 for C++ development. I find the interface to be much better than MSVC 6.

Last time I checked there was no IDE that shipped with a 100% ANSI compliant C++ compiler. However, you may want to check out Comeau computing for the most ANSI compliant C++ compiler I know of.

Share this post


Link to post
Share on other sites
100% compliant? I'm not sure... but the Visual Studio 7 (e.g., Visual Studio .NET) compiler is pretty darn close. VC6 is not cool, you should switch over to 7... academic pricing's pretty cheap.

As far as other options go, there's always Dev-C++. I personally don't find it as nice as Visual Studio, but it uses a GCC port as its compiler so it will be pretty compliant.

Quote:

*all classes inherit from Object base class
*Garbage Collection through smart pointers and reference counting
*Run Time Type information
*etc


Not all classes should inherit from a base... that's generall over kill. For many objects in some systems it can make sense to do so, but not all. Just be aware of what you are doing and don't immediately subclass every new class you design from a base Object. For example, if an Object's purpose is to provide your aforementioned reference counting mechanism, it doesn't neccessarily make much sense for your exception classes to be derived from Object, for example.

Which leads me to reference counting/smart pointers... It's probably a good idea to use an already-existing smart pointer implementation (such as those in Boost or Loki) rather than roll your own. An ironclad smart pointer is not a trivial task.

RTTI you may not actually need. If you really, REALLY think you need it, you can build it in to the Object base class, which will help provide an actual, meaningful reason for having a generic Object base class. Having one "just for the hell of it" is probably not a good idea.

Share this post


Link to post
Share on other sites
Im just working my way through David Eberly's 3D game Engine Archtecture at the moment so archtecturewise im going with what he has to say for now (its a very good book)

I've just downloaded Dev-C++ so ill be givin that a try over the next few days and see what its like other than hat ill try get my hands on stusio 2003 i suppose if dev-c++ goes belly up. thanks

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!