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.

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].

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

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

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?

Sahana said:   1 decade ago
Why structures cannot have functions as members? Isn't it that the structures can have both data members and functions as its members?


Post your comments here:

Your comments will be displayed after verification.