I have 3 classes using templates, and 2 from an abstract base class. In my main() I am applying polymorphism concepts, but from the pointer to base class, the objects of the derived class are not being initialized. I'm not sure where the problem is in my code.
#include<iostream>
#include<conio.h>
using namespace std;
template<class T>
class polygon
{
protected:
    T a,b;
public:
    virtual T area()=0
}
template<class T>
class rectangle:public polygon
{
public:
    rectangle(T c,T d)
    {
        a=c;
        b=d;
    }
    T area()
    {
        return (a*b);
    }
};
template<class T>
class triangle:public polygon
{
public:
    rectangle(T c,T d)
    {
        a=c;
        b=d;
    }
    T area()
    {
        return (.5*a*b);
    }
};
template<class T>
class rectangle
{
public:
    rectangle(T c,T d)
    {
        a=c;
        b=d;
    }
    T area()
    {
        return (a*b);
    }
};
void main (void)
{
polygon<float>*ppoly=new rectangle<float>(4,5);
cout<<ppoly->area();
getche();
}
 
     
    