|
![](/i/fill.gif) |
> You can do pretty much the same thing in C++, by implementing the methods
> in the class declaration. Of course this is recommended only for small
> classes. With large classes you'll end up with a megaclass which will be
> hard to understand and maintain, so it will cause more trouble than it's
> worth.
Yes, this had always been my mentality with C++ too, in fact it was very
rare I would put any actual code in the class declaration file. With C#
though it kind of forces you to do this (I don't know whether it's possible
not to), which at first I thought was terrible, but once I got used to
"collapsing" the code with the little +/- icons in the margin, I think it
works really well. You can have multiple levels of the collapse tree and
define your own collapse regions in the code if you want (so if you had
several methods implemented all relating to one part, you could collapse all
these together). The result is that the source file *looks* like simply the
class declaration, but when you need to you can expand any part to see the
actual code.
If I went back to using C++ for something, I might be tempted to do this
too. I wonder if the Visual C++ Express edition IDE is the same as the C#
one? Maybe I just have an old version of the C++ one that doesn't contain
some of the newer features.
Post a reply to this message
|
![](/i/fill.gif) |