Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include Circle.h int Circle::numberOfObjects = 0; // Construct a default circle object Circle::Circle() { radius = 1; numberOfObjects++; } // Construct a circle object Circle::Circle(double

image text in transcribed
#include "Circle.h"

int Circle::numberOfObjects = 0;
// Construct a default circle object
Circle::Circle()
{
radius = 1;
numberOfObjects++;
}

// Construct a circle object
Circle::Circle(double radius)
{
this->radius = radius;
numberOfObjects++;
}

// Return the area of this circle
double Circle::getArea() const
{
return radius * radius * 3.14159;
}

// Return the radius of this circle
double Circle::getRadius() const
{
return radius;
}

// Set a new radius
void Circle::setRadius(double radius)
{
this->radius = (radius >= 0) ? radius : 0;
}

int Circle::getNumberOfObjects()
{return numberOfObjects;}

Circle::~Circle() {numberOfObjects--;}
The Cricle class definikion and imblementetion are given in the "Files Nireded For Ceursework Eram 2 . The fotowing testCircle.cpp file is vsed with the Cirele ciass: Fhelude dostream: znclede "Circle ti" using namespace sti, int main0 (.) Circle "pCircle 1 a new Cirele (25) is Ior (i int i=0;i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

Students also viewed these Databases questions