Name:
Anonymous
2007-04-05 4:23
ID:XM7baoLH
What do I read to learn C++?
I like books with little text and lots of short example code. But anything good is fine.
Name:
Anonymous
2007-04-06 10:23
ID:ryKTpqqR
If you're going to be a pussy about programming in C++, at least be a pussy about stuff that's interesting.
template <class Derived>
struct base
{
void interface()
{
// ...
static_cast<Derived*>(this)->implementation();
// ...
}
};
struct derived : base<derived>
{
void implementation();
};
Or perhaps:
template<int dimension>
Vector<dimension>& Vector<dimension>::operator+=(const Vector<dimension>& rhs)
{
for (int i = 0; i < dimension; ++i)
value[i] += rhs.value[i];
return *this;
}
(Both samples stolen from
http://en.wikipedia.org/wiki/Template_metaprogramming)