C++ Programming - OOPS Concepts - Discussion

Discussion Forum : OOPS Concepts - General Questions (Q.No. 52)
52.
Which of the following statements is correct in C++?
Classes cannot have data as protected members.
Structures can have functions as members.
Class members are public by default.
Structure members are private by default.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
15 comments Page 1 of 2.

Shubham Barnwal said:   1 decade ago
B is incorrect answer.

Structure can't have function as a member.
(1)

P@v@N said:   10 years ago
C++ structs can definitely have member functions. C structs, on the other hand, are a much different beast -- they're essentially arrays that provide names and type information for certain indices.
(1)

Chinna said:   1 decade ago
Structures can have functions as members in C++.

Then What about structures in C?

Dipjoyti said:   1 decade ago
Class members are public by default.

Structure members are private by default. Is that are correct. Explain?

Sandesh said:   1 decade ago
Class members are private by default in c++.

Rasool said:   1 decade ago
Class members are private by default.
Structure members are public by default.

Classes can have data as protected members.
Structures can have functions as members.

Abc said:   1 decade ago
If we don't provide any accessor in class members, it will be private?

Ghost in oops said:   1 decade ago
Class members are always public by default hence answer is option [C].

Gopal said:   1 decade ago
How can structures have functions as members?

Akash said:   1 decade ago
Can some one give me example of such struct?


Post your comments here:

Your comments will be displayed after verification.