In C++, structure can contain data members, as well as functions that can operate upon the data members. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

In C++, structure can contain data members, as well as functions that can operate upon the data members.

15th Jan 2017, 10:27 AM
Avnish Tomar (CCS University)
Avnish Tomar (CCS University) - avatar
2 Answers
+ 1
yes you do that with classes ,but you can't do that with struct ex: class Myclass{ public: int sum(int a,int b) { return a+b; } };
15th Jan 2017, 11:09 AM
A M ~ Smart !
A M ~ Smart ! - avatar
+ 1
Class is better
15th Jan 2017, 12:27 PM
Mrietunjoy Sarkar
Mrietunjoy Sarkar - avatar