I have to add a class object as member within a c struct.
Is there any prohibition doing this.
Regards, iSight
I'll assume you're talking about C++, since there is no concept of a "class" in C - although you certainly can have a struct as a member of another struct.
Apart from one unimportant detail, class and struct are identical, and both are often referred to as "class types". Anything you can do with a class (such as having a member of class type), you can also do with a struct.
If you're interested, the only difference is the default accessibility of members and base classes; public for struct, and private for class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With