c++ - structure defined inside of class -
this question has answer here:
i'm newbie in c++, consider following snippet:
class myclass { ... struct entrykeybase { void setoperation(optype oper) { operation = oper; } optype getoperation() const { return operation; } virtual void serialize(std::ostream& os) const = 0; protected: optype operation; }; struct protoentrykey: entrykeybase { // methods here protoentrykey(uint8_t l4proto) : proto(l4proto) // ??? { operation = inserted; } protected: uint8_t proto; }; // here more structs defined... public: ... }; what line marked ??? do? understand declare structure inheriting entrykeybase, whatever follows ':' don't understand, syntax mean? thanks!
it initialization list. assigns value of l4proto proto variable in struct protoentrykey.
Comments
Post a Comment