   Factory segmenation fault?!!
  I have made a abstract factory, that registers a class with my object manager as a string.NOw whan i go to call create, it returns something, but when i go to call a function on it, it causes a segmentation fault.class Obj;class RegBase;class ObjMgr{public:static void Register( std::string str, RegBase* obj );static Obj* Create( std::string classId );/* * called by an objects constructor * if it returns false, it means it wasnt added * which also means a net object shouldnt be registered! * */static bool RegisterObject( Obj* obj );;/* * called to update all objects */static void Update( unsigned long tick );/* * delete all objects */static void Shutdown();//static void Update( unsigned int tick );protected:static std::map< std::string, RegBase* > classes; //a list of classes that can be createdstatic std::list< Obj* > objects; //a list of all game objects};class RegBase{public://virtual Obj* Create() = 0;virtual Obj* Create(){return 0;}};template class ObjReg : public RegBase{public:ObjReg( std::string classId ){ObjMgr::Register( classId, (RegBase*)this );}T* Create(){return (new T);//return 0;}protected:};then i register an object like:ObjReg regReg("chat");so on my obj manager i hsould be able to call:ObjMgr::Create("chat");which will return a pointer to a chat, but actually returns something other than zero, but wjen i try to call a function on it, it fails? maybe because im calling a function that isnt part of Obj as thats what Create will return, although i do cast it to what it should have :-/ 
  If the problem is in the code you''ve posted, then it''s probably that Create() ought to return an Obj*, not a T*, in your template implementation.By the way: keeping "updatable" and "manufacturable" in the same base manager is a bad idea. You might want to manufacture objects that aren''t steppable, and step objects that aren''t made in a factory. I''d suggest having steppable classes inherit from ISteppable, which in its constructor registers with the steppable-manager, and the steppable-manager should have the list of all steppable objects. Or you can use a static list and a static step-all function inside ISteppable itself. ;  I have tried making it return an Obj* instread of a T*but still get the error....hrmm maybe the error isnt there :-/ /must do more pinful debugging ;  okay the problem is calling a virtual function...i get back an Obj* from my factory,and i assume it is a NetObj* (it has to be)so i cast it to a NetObj*then i call IsNetOBj() which printf out if it is a net obj, which it does print out correctly,so when i call GetClassId() which should return a char* but all i get is crap. I also got GetClassId to print something to console, but this doesnt get called, wither does the virtual method from the base class :-/ ;  So you''re trying to call a virtual function GetClassId from inside the constructor of the Obj* ?  That''s one of those big c++ no-no''s, because the vtable of the Obj doesn''t get set up til after it''s constructed.So delay the virtual call til after the object is fully constructed and see if that works. ;  no i dont call anything from the constructor, it gets called after construction ;  GetClassID returns a (char *)?What does that pointer point to? (Mode of allocation, scope, etc...)   Victor Nicollet, INT13 game programmer ;  returns a char* yes, but i put a printf in that function to make sure it was being called or not, and its not... I also create a another function in the base class, and the child class, firstly as non virtual, and the function from the base class got called as expected, then i tried making it virtual, and neither function was executed.:-/here is my inheritence diagram:objNetObj:::/:    /:  /Chat : public virtual Obj, public virtual NetObjso i get a Obj back from create, i cast it to NetObj ( I know its a class that inherits from NetObj.Then i call a virtual function on my cast NEtObj instance, and nothing happens (ie. no function is called) 