Whats the difference? Are they not the same?
Printable View
Whats the difference? Are they not the same?
They are the same. Well except for the minor difference that class members are by default private and struct's, public.
Code:
class X {
int private_num;
public:
int public_num;
};
struct X {
int public_num;
private:
int private_num;
};
Can we have member functions in structs?
Can we make inheritance with structs?
Can we overload operators?
Correct me if I'm wrong... I think (no).
YesQuote:
Originally posted by ammar
Can we have member functions in structs?
Can we make inheritance with structs?
Can we overload operators?
Correct me if I'm wrong... I think (no).
Yes
and Yes
Structs are just like classes...excepts public by default
Mmmmmm...
Thanks, I didn't know that...
So there isn't a big difference.