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

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -