Multiple choice technology programming languages

Which of the following language feature is not an access specifier in C++?

  1. Public

  2. Private

  3. Protected

  4. Internal

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In C++, access specifiers are public, private, and protected. Internal is not an access specifier in C++ - it's used in some other languages like C# to limit accessibility within the same assembly. The other options (public, private, protected) are all valid C++ access specifiers.

AI explanation

To answer this question, you need to understand the concept of access specifiers in C++.

Access specifiers in C++ are used to define the visibility and accessibility of class members (variables and functions) within a class or from outside the class. There are three access specifiers in C++: public, private, and protected.

Here is an explanation for each option:

Option A) Public - This option is a valid access specifier in C++. Public members are accessible from within the class, as well as from outside the class.

Option B) Private - This option is a valid access specifier in C++. Private members are only accessible from within the class.

Option C) Protected - This option is a valid access specifier in C++. Protected members are accessible from within the class and its derived classes.

Option D) Internal - This option is not a valid access specifier in C++. "Internal" is not an access specifier in C++. It is not used to define the visibility or accessibility of class members in C++.

The correct answer is option D) Internal. This option is not an access specifier in C++.