Advertisement

Reference Objects vs Value Objects

Started by April 23, 2010 12:40 AM
0 comments, last by WitchLord 14 years, 6 months ago
I am assuming that the difference between reference objects and value objects is that value objects are copied by value (and hence not suitable for large/complex classes) where as value objects are more basic types like vectors. My question is, say I have a 'Player' class. This would be a reference class. Why can I not assign it a constructor/destructor, but HAVE to use a reference counter and factory?
The only difference between the factory and the constructor, is that the factory is responsible for allocating the memory as well as initializing it, whereas the constructor is only responsible for initializing the memory that has already been allocated by the caller.

You cannot register a destructor for a reference type, because AngelScript will never call it. AngelScript only calls the Release behaviour when it doesn't use the object anymore. The release behaviour is responsible for destroying the object when there are no more references to it.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement