when compiling code from my main function ireceive the following errorerror: conversion from 'rectangle*' to non0scalar type 'rectangle' requested
My code is quite simple;
Here's my main function
#include <iostream>
#inclde "rectangle.h"
using namespace std;
int main()
{
rectangle rect = new rectangle(3,4);
cout<<rect.area()<<endl;
cout<<rect.perimeter()<<endl;
return 0;
}
here's my class
#ifndef RECTAGLE_H
#define RECTAGLE_H
#include <iostream>
#include <cmath>
using namespace std;
class rectangle{
public:
int length, width;
rectangle(int x, int y){
length = x;
width = y;};
~rectangle();//destructor
int area()
{
int a = length*width;
return a;
}
int perimeter()
{
int b = 2*length*width;
return b;
}
double diagonal()
{
int c = sqrt(length*length + width*width);
return c;
}
};
#endif // RECTAGLE_H