Jump to content
  • Advertisement
Sign in to follow this  
Ameise

Reference Objects vs Value Objects

This topic is 2982 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

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?

Share this post


Link to post
Share on other sites
Advertisement
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.

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!