Write a class declaration named Circle with a private member variable named radius

Chapter 13, Problem 43

(choose chapter or problem)

Get Unlimited Answers
QUESTION:

Write a class declaration named Circle with a private member variable named radius. Write set and get functions to access the radius variable, and a function named getArea that returns the area of the circle. The area is calculated as 3.14159 * radius * radius

Questions & Answers

QUESTION:

Write a class declaration named Circle with a private member variable named radius. Write set and get functions to access the radius variable, and a function named getArea that returns the area of the circle. The area is calculated as 3.14159 * radius * radius

ANSWER:

Step 1 of 3

C++ is an object-oriented language that is used in many applications. Class is the collection of related objects and methods. Methods can be called by the instantiation of objects from the main class. The class name must start with the upper case and the class will have access specifiers to have access control over the variables and methods. There are three types of access specifiers public, private, and protected.

Add to cart


Study Tools You Might Need

Not The Solution You Need? Search for Your Answer Here:

×

Login

Login or Sign up for access to all of our study tools and educational content!

Forgot password?
Register Now

×

Register

Sign up for access to all content on our site!

Or login if you already have an account

×

Reset password

If you have an active account we’ll send you an e-mail for password recovery

Or login if you have your password back