On 2 Nov 2005 05:00:29 -0800,
54*****@163.com wrote:
who can tell me which two features in the C++ language are most
usefule, and which two features that you think are the most over-rated
or the most misused and why you think so? Thanks very much!
[I normally don't respond to trolls, but I think there are sensible
answers to these questions, so I hope this isn't an attempt at
trolling...]
Most useful -- without a doubt, polymorphism and encapsulation. These
are features which can be found to some degree in other languages, but
the C++ implementation of these concepts is quite powerful and cannot
be found elsewhere IMHO. Templates and generic programming are almost
equally important, though. But since they came later to C++, I will
say that polymorphism and encapsulation are more important since they
were there from the very beginnings of C++ ("C with classes").
The other question is more difficult to answer. People tend to misuse
just about everything, but this is no fault of the language itself.
And I would say that just about all the features in C++ which are used
at all are certainly important. For example, should we condemn the use
of pointers just because there are people who do not use them
properly? You cannot outlaw the knife just because it is sometimes
used to hurt other people.
However, there are two things which probably not many people use and
might possibly be overrated:
(1) export (for templates). This is a potentially very useful feature,
but hardly any widely-used compiler vendors have implemented it. Many
seem to think that we could therefore get along quite well without it.
I can get along without it, but it would be nice to have for hiding
parts of the template source code. Once there are more compilers which
offer this feature, it will be easier to determine whether it is
actually as useful as those who introduced it seem to think it is.
(2) the <c...> STL headers which put the C runtime functions into the
std namespace. Since the names are almost always in the global
namespace anyway, I think most people just use the <.h> headers for
these (not for any other standard libraries, though...it is important
to remember to use <iostream> instead of <iostream.h>, for example).
--
Bob Hairgrove
No**********@Ho me.com