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.
Nikita said:
5 years ago
Are structure members really private? Please explain to me.
Akshay said:
9 years ago
In C, it is not allowed to have member function but in C++, it is allowed.
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'.
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)
Gurubatham said:
1 decade ago
A 'structure' cannot have member function. Whereas a 'class' can have member function.
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?
Akash said:
1 decade ago
Can some one give me example of such struct?
Gopal said:
1 decade ago
How can structures have functions as members?
Shubham Barnwal said:
1 decade ago
B is incorrect answer.
Structure can't have function as a member.
Structure can't have function as a member.
(1)
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