If a base class is very general you can prevent instantiation of this class by making it abstract.
Here you make Polygon abstract. What would you want to do with a Polygon?It just holds some common properties for a triangle,rectangle etc. Even Quadrilateral could be abstract. The class you want to work with here is a Square. Square will never be abstract you must be able to instantianate a Square into an object to work with.
Abstract classes are not instantiateable (you can't make one) for example, if Polygon is abstract, the compiler will not let you call: new Polygon(); A class is normally made abstract by defining one (or more) methods as 'pure virtual'. A pure virtual method is one that is declared (return type, arguments, etc.) but not defined (no function body).
A pure virtual method is one that is declared (return type, arguments, etc.) but not defined (no function body).
That's not true. A pure virtual function can be defined (i.e. it can have a function body).
Something like virtual int draw() = 0;
In C++, the "=0" in the declaration is what makes the function pure virtual. In C++, a class with one or more pure virtual function is abstract, and cannot be instantiated. The purpose is that the base class provides a defined interface, and derived classes are forced to override and supply their own versions of the pure virtual functions. In this way, derived classes implement (or extend) the interface that is specified by the abstract base class.
Guess it would be good to mention that an abstract class is mostly an interface, a common interface for all derevied ones. For example you can make an abstract class with only one pure virtual overloaded operator= and derive from it all "assignable" classes.