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 2 of 2.

Gurubatham said:   1 decade ago
A 'structure' cannot have member function. Whereas a 'class' can have member function.

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)

Neha said:   10 years ago
In C++, a structure can have both variables and functions as members unlike C. In C++ structure, we can also declare some of the members as 'private'.

Akshay said:   9 years ago
In C, it is not allowed to have member function but in C++, it is allowed.

Nikita said:   5 years ago
Are structure members really private? Please explain to me.


Post your comments here:

Your comments will be displayed after verification.