You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: tutorial/cpp/cpp.md
+4-6
Original file line number
Diff line number
Diff line change
@@ -181,12 +181,10 @@ class Gigel {
181
181
182
182
int main() {
183
183
Gigel g; // print "Gigel()"
184
-
Gigel g2{}; // print "Gigel()"
185
-
Gigel g3{10}; // print "Gigel(10)"
184
+
Gigel g2(); // print "Gigel()"
186
185
Gigel g4(5); // print "Gigel(5)"
187
186
}
188
187
```
189
-
Note: In C++ we call the constructor for a class `Gigel` by using `Gigel()` or `Gigel{}`. It's strongly recommended to only use the `{}` notation in order to avoid some weird compile error (see [Most vexing parse C++](https://en.wikipedia.org/wiki/Most_vexing_parse)).
190
188
191
189
#### Destructor
192
190
A destructor is a **special method** that is called `when` the lifetime of an object ends. The purpose
@@ -268,7 +266,7 @@ A function which may have generic parameter(s) or return type.
0 commit comments