gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-commit] /srv/bzr/gnash/trunk r11960: struct -> class reconstr


From: Benjamin Wolsey
Subject: Re: [Gnash-commit] /srv/bzr/gnash/trunk r11960: struct -> class reconstruction
Date: Wed, 24 Feb 2010 18:54:43 +0100

>   I prefer to use classes than structs with all public members
myself. 
> > Using structs reminds me too much of GameSWF.
> 
> +1 :D

Structs are sometimes useful for grouping several data elements
together. This is not for encapsulation; it's for collection. In these
cases there is no benefit to providing accessor and mutator functions
for all of them. If you did that, a struct containing 10 members would
then end up with at least 20 member functions as well as the 10 members,
and what would you gain from it?

In cases where you want to encapsulate data, I agree that it's better
for all non-const, non-static data members to be private. A useful class
should be able to do useful things with that data rather than just
returning it or changing it. In this case the only debate is whether to
use the "struct" or the "class" class-key. This is entirely personal
preference, but, as I said, I'm quite happy to use "class" in all these
cases.

bwy

--
The current release of Gnash is 0.8.7
http://www.gnu.org/software/gnash/

Benjamin Wolsey, Software Developer - http://benjaminwolsey.de
C++ and Open-Source Flash blog - http://www.benjaminwolsey.de/bwysblog

xmpp:address@hidden
http://identi.ca/bwy



Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil


reply via email to

[Prev in Thread] Current Thread [Next in Thread]