C++ Programming - OOPS Concepts - Discussion
Discussion Forum : OOPS Concepts - General Questions (Q.No. 21)
21.
Which of the following is correct about class and structure?
Discussion:
23 comments Page 2 of 3.
Samba said:
1 decade ago
In C++ we can do
>
> struct Box{
> int x;
> int y;
> void function(){cout<<x<<" "<<y<<endl;};
> }
>
> struct Box{
> int x;
> int y;
> void function(){cout<<x<<" "<<y<<endl;};
> }
Harsh said:
1 decade ago
I agree with shivam. Because only class have the membr function structure don't have the member function.
Shivam said:
1 decade ago
Even the option A is correct. We don't have member functions declared in class.
Ashutosh Ghimire said:
1 decade ago
@Ravi Mayank.
You are mixing up C and C++. C is not an OOP.
You are mixing up C and C++. C is not an OOP.
Rahul Shirole said:
3 years ago
Structures in c++ can have member functions like class.
(1)
Priya said:
9 years ago
Anybody can explain option A, in detailed form?
Chinmoy said:
1 decade ago
In C++ structure can contain member variable.
Raghava said:
1 decade ago
Can structures in C, have member functions?
Thas said:
1 decade ago
So structure can hold member functions?
Manpreet said:
8 years ago
I think A is also the correct answer.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers