hamburger menu
All Coursesall course arrow
adda247
reward-icon
adda247
    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

    DSSSB PRT Full Mock - 01

    languageIcon English
    • pdpQsnIcon200 Questions
    • pdpsheetsIcon200 Marks
    • timerIcon120 Mins
    languageIcon English
    Free
    Must Attempt

    Educational Psychology & Pedagogy - 01

    languageIcon English
    • pdpQsnIcon20 Questions
    • pdpsheetsIcon20 Marks
    • timerIcon15 Mins
    languageIcon English
    Free
    Must Attempt

    DSSSB PRT PYP Held on 7th March 2022 Shift 1

    languageIcon English
    • pdpQsnIcon200 Questions
    • pdpsheetsIcon200 Marks
    • timerIcon120 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
    368k+ students have already unlocked exclusive benefits with Test Prime!
    Our Plans
    Monthsup-arrow