ProgrammingEasyIBM · Deloitte pattern
In C++, members of a class declared without any access specifier are:
- A. private
- B. Accessible within the same file
- C. public
- D. protected
Correct answer: A. private
class members default to private, while struct members default to public. That is the only real difference between the two keywords (default inheritance follows the same rule).
More OOP with C++ and Java questions
- Which statement about Java String objects is correct?
- What is printed? java String s = "ab"; s.concat("cd"); s.toUpperCase(); System.out.print(s);
- Which pairing is correct?
- Which of these operators cannot be overloaded in C++?
- A variable declared inside a Java interface is implicitly:
- What is printed? cpp class A { public: A() { cout << "A"; } ~A() { cout << "a"; } }; class B : public A { public: B() { cout << "B"; }…