+ 5
In C++, structure can contain data members, as well as functions that can operate upon the data members.
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;
}
};
+ 1
Class is better