mirror of
https://github.com/Light-City/CPlusPlusThings.git
synced 2026-04-02 10:13:06 +08:00
update
This commit is contained in:
23
codingStyleIdioms/1_classInitializers/initializer.cpp
Normal file
23
codingStyleIdioms/1_classInitializers/initializer.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Created by light on 19-12-9.
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
class A {
|
||||
public:
|
||||
A(int a) : _a(a), _p(nullptr) { // 初始化列表
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
int _a;
|
||||
int *_p;
|
||||
};
|
||||
|
||||
int main() {
|
||||
A aa(10);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user