Question: Analyze the following code: #include #include Circle.h using namespace std; int main ( ) { cout < < Circle ( 5 ) . getArea

Analyze the following code:
#include
#include "Circle.h"
using namespace std;
int main()
{
cout << Circle(5).getArea()<< endl;
cout <<(new Circle(5))->getArea()<< endl;
return 0;
}
The program has a compile error on Circle(5).getArea().
The program has a compile error on (new Circle(5)).getArea().
The program compiles, but cannot run.
The program compiles and runs, but new Circle(5) creates an anonymous object on the heap. This causes memory leak.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!