Code:
virtual void GetDescription (std::ostringstream &desc) const =0
Piece by piece:
This means that the function is virtual. Derived classes can provide a function with the same signature that will be called instead even if you call the function through a reference or pointer to the base class. Read more
here.
This is the return type. "void" means the function doesn't return anything.
This is the function name.
Code:
(std::ostringstream &desc)
The function takes a single argument (with the name "desc") of type "std:: ostringstream &". An
ostringsteam is an output stream that operates on strings. String streams are useful for building strings piece-by-piece (normal C++ strings are immutable, so if you build a string by concatenating smaller strings together, you do a lot of object creation and deletion, which is inefficient). The "&" means that the parameter is passed by reference. See
here for more info on the various ways you can pass arguments.
This means that the function is not allowed to change any internal class members (if you try, you'll get a compile error unless you use a const_cast to override this).
This part is an addendum onto "virtual"...it further means that this function is "pure virtual". This means that this class is an abstract and cannot be instantiated. What good is a class that can't be instantiated? Well, you can have other classes that inherit from this one, and they can supply their own implementation of this method (in fact, they need to, otherwise they are also abstract).