C++ Programming - OOPS Concepts - Discussion
Discussion Forum : OOPS Concepts - General Questions (Q.No. 52)
52.
Which of the following statements is correct in C++?
Discussion:
15 comments Page 1 of 2.
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)
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.
Structure members are public by default.
Classes can have data as protected members.
Structures can have functions as members.
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'.
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?
Dipjoyti said:
1 decade ago
Class members are public by default.
Structure members are private by default. Is that are correct. Explain?
Structure members are private by default. Is that are correct. Explain?
Gurubatham said:
1 decade ago
A 'structure' cannot have member function. Whereas a 'class' can have member function.
Chinna said:
1 decade ago
Structures can have functions as members in C++.
Then What about structures in C?
Then What about structures in C?
Akshay said:
9 years ago
In C, it is not allowed to have member function but in C++, it is allowed.
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].
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers