Saved Bookmarks
| 1. |
Write a class declaration for a class named Circle, which has the data member radius, a double, and member functions setRadius and getArea. Write the code for these as inline functions? |
|
Answer» Answer: The mechanism that allows you to combine data and the FUNCTION in a SINGLE unit is called a class. Once a class is defined, you can declare variables of that type. A class variable is called object or instance. In other WORDS, a class would be the data type, and an object would be the variable. Classes are generally declared using the keyword class, with the FOLLOWING format: class class_name { private: members1; protected: members2; public: members3; }; |
|