当前位置: 动力学知识库 > 问答 > 编程问答 >

c++ - `Class::Class() : a(0), b(1)` meaning

问题描述:

This question already has an answer here:

  • What is this weird colon-member (“ : ”) syntax in the constructor?

    11 answers

网友答案:

It means that you are defining a constructor for class Server which is declared with one int parameter. The class has fields listen_sock which is being set to 0 and then current_autogen_nickname which is being set to 1

You are basically defining a constructor and using an initializer list.

分享给朋友:
您可能感兴趣的文章:
随机阅读: