Correct option is B
The number of access specifiers in a class of C++ is 3. These specifiers—public, private, and protected—play a critical role in controlling the visibility and accessibility of the class members.
Important Key Points:
1. Public: Members declared as public are accessible from anywhere in the program. This access specifier is used when members need to be available outside the class.
2. Private: Members with private access are only accessible within the class itself or by friend functions. This ensures encapsulation and data protection.
3. Protected: Protected members can be accessed within the class and its derived classes. This specifier is useful for inheritance and restricting external access.