Which of the following can be declared inside an unnamed class in C++?
Options
- A. Data members
- B. Member functions
- C. Access specifiers
- D. More than one of the above
- E. None of the above
Quiz Practice:
D. More than one of the above
Answer: (D) More than one of the above
An unnamed class can contain normal class members such as data members and member functions.
It can also use access specifiers such as public, private and protected.
For example:
class {
public:
int value;
void show() { }
} obj;
Therefore, all three listed features are possible.