Archived

This topic is now archived and is closed to further replies.

Load/Save Internal or External

This topic is 5046 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 have a class, Sprite (but it could be anything like object or entity) that has a file format and during game time I need to load the sprite''s information for the hard drive. Is it better to have the Load routine as a member of Sprite so to use it I would go:
testSprite.Load("mysprite.spr"); 
or to load it externally of the class like
LoadSprite(&testSprite,"mysprite.spr"); 
I know both ways will work, and I''m not really looking for which one is faster, just whether it is standard, or accepted to have it internal or external. --------------------- Ryan Bujnowicz [ vangelis ]

Share this post


Link to post
Share on other sites
I would go with the first approach. That way you don''t mix OOP code with global functions, and that makes it more consistent in my opinion.

cya,
Drag0n

-----------------------------
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning..." -- Rich Cook

My future web presence: Dave''s Programming Resources

Share this post


Link to post
Share on other sites