gpt4 book ai didi

关于类定义的 C++ 编程约定

转载 作者:行者123 更新时间:2023-11-28 03:13:41 26 4
gpt4 key购买 nike

<分区>

在没有任何正规 IT 教育的情况下学习如何编程,我对许多常见的编程约定相当陌生。这些细节虽然无关紧要,但困扰了我很长时间,如果能得到更专业的意见,我会感到很欣慰。

class Bar{};
class Foo
{
public: //Is [public > protected > private] the usual order?
Foo(); //Should constructors and destructors be listed before
void doStuff(void); //..other member functions?
int publicVariable; //Should data members be kept separate from methods?
private:
int x_; //Is there an established order regarding data members?
bool isReady_;
Bar bar_; //Trailing underscore on private class instances?
};

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com