Daniel, pictured above, please, the iterator is a class template, why is a struct, rather than the class iterator, which do not understand, I need to fill the convenience of knowledge, and answer, please!
CodePudding user response:
Struct is more suitable for the implementation of the body as a data structure, class is more suitable for body as an object,In C + + struct in C struct expansion, it is no longer just a data structure containing different data types, it has access to the function of too many,
Struct can contain a member function? Can!!!!
Struct can inherit? Can!!!!!
Struct can implement polymorphism? Can!!!!!!!!!
Since these it can realize, that what is the difference between it and the class can also?
The essence of the difference is that the default access control:
The default inheritance access
Struct is public, the class is a private,