Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / C++ - Multiplayer design. Class or struct?

Author
Message
Hayer
18
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Norway
Posted: 27th Feb 2009 20:41
Hi!

Just wondering about what would be the best approach for handeling the players serverside and clientside?

Like a class with functions/methods like move, char* cNick, etc, or a struct, and do all the movement, etc in a for-statement?

What do u guys think? Examples? Experience? Share please

Keep it simple.
Questions? Mail me
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 28th Feb 2009 16:00
classes and structs are indetical in modern compilers, except for the private/public defaults respectively. That said, most people use structs for objects without function, so i would use class with functions in like move, and this way its way easier to use it again for other things in the future.
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 28th Feb 2009 16:20
@jezza
Actually, they aren't
There are a few other differences between them as well, although you are right that none of them are relevent here.

[b]Yuor signutare was aresed by a deslyxic mud...
BOX2D V2 HAS HELP FILES! AND A WIKI!
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 1st Mar 2009 15:36 Edited at: 1st Mar 2009 15:55
Quote: "There are a few other differences between them as well"


Like what? I've always thought that the only differences were the default visibility of the members and the default inheritance behaviors (structs inherit publically by default whereas classes inherit privately by default).

Login to post a reply

Server time is: 2024-09-30 19:22:50
Your offset time is: 2024-09-30 19:22:50