Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > by-pkgid > df9ea7795df4854489abb269f13c9938 > files > 32

ksquirrel-libs-0.8.0-3mdv2009.0.i586.rpm

#include "polygon.hpp"
#include <cmath>

class triangle : public polygon
{
	public:
		virtual double area() const
		{
			return side_length_ * side_length_ * sqrt(3) / 2;
		}
};

// the class factories
extern "C" polygon* create()
{
    return new triangle;
}

extern "C" void destroy(polygon* p)
{
    delete p;
}