Timeline for Avoiding Object Oriented Pitfalls, Migrating from C, What Worked for You?
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 21, 2011 at 3:32 | comment | added | Gene Bushuyev | you need to clearly distinguish between aggregate classes (infrequent case) and classes with functionality (general case). The latter must practice encapsulation and access its members via public interface only, no data should be exposed public. | |
Jun 21, 2011 at 3:05 | history | migrated | from stackoverflow.com (revisions) | ||
Jun 21, 2011 at 2:58 | comment | added | jpm | Yeah, I agree here if you're in C++ (which the question did mention), but I do most of my work in Java, and we have no struct, unfortunately. | |
Jun 21, 2011 at 2:57 | comment | added | Dominic Gurto |
I'd also suggest, if you have such classes that just hold public data, you should declare them as struct s - it makes no semantic difference, but it clarifies the intention, and makes their usage seem more natural, especially to C programmers.
|
|
Jun 21, 2011 at 2:53 | history | answered | jpm | CC BY-SA 3.0 |