GIven a class definition:
class Circle
{
private:
int radius;
public:
Circle (int inputRadius)
{ radius = inputRadius; }
}
Please provide 2 distinct ways to create circle_object with initial radius value = 5.
class Circle
{
private:
int radius;
public:
Circle () {}
Circle (int inputRadius)
{ radius = inputRadius; }
};
int main()
{
//1.
Circle circle_object(5);
//2.
Circle *circle_object1(5);
}
Comments
Leave a comment