write a program to find area of circle using class, constructor function and destructor?
Answers
Answered by
0
Explanation:
#include<iostream>
using namespace std;
class Test {
public:
float r, area;
Test() {
cout << "Enter radius of a circle:";
cin >> r;
area = 3.14 * r * r;
}
void display() {
cout << "Area of circle is: " << area;
}
};
int main() {
Test obj;
obj.display();
return 0;
}
Similar questions