Answer to Question #221666 in C++ for Yang Yang

Question #221666

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. 


1
Expert's answer
2021-07-31T07:17:05-0400
class Circle


{


   private:


     int radius;


   public:
   Circle () {}


     Circle (int inputRadius)


     { radius = inputRadius; }


};


int main()
{
    //1.
    Circle circle_object(5);
    //2.
    Circle *circle_object1(5);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS