arrow
arrow
arrow
The number of access specifiers in a class of C++ is
Question

The number of access specifiers in a class of C++ is

A.

2

B.

3

C.

4

D.

More than one of the above

E.

None of the above

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.

Free Tests

Free
Must Attempt

UPTET Paper 1: PYP Held on 23rd Jan 2022 (Shift 1)

languageIcon English
  • pdpQsnIcon150 Questions
  • pdpsheetsIcon150 Marks
  • timerIcon150 Mins
languageIcon English
Free
Must Attempt

UPTET Paper 2 Social Science : PYP Held on 23rd Jan 2022 (Shift 2)

languageIcon English
  • pdpQsnIcon150 Questions
  • pdpsheetsIcon150 Marks
  • timerIcon150 Mins
languageIcon English
Free
Must Attempt

UPTET Paper 2 Maths & Science : PYP Held on 23rd Jan 2022 (Shift 2)

languageIcon English
  • pdpQsnIcon150 Questions
  • pdpsheetsIcon150 Marks
  • timerIcon150 Mins
languageIcon English
test-prime-package

Access ‘BPSC TRE (11-12)’ Mock Tests with

  • 60000+ Mocks and Previous Year Papers
  • Unlimited Re-Attempts
  • Personalised Report Card
  • 500% Refund on Final Selection
  • Largest Community
students-icon
353k+ students have already unlocked exclusive benefits with Test Prime!
Our Plans
Monthsup-arrow