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: sources/modules/object-model/constructors.md
+7-8Lines changed: 7 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -77,11 +77,13 @@ implementation-defined, unspecified, or undefined behavior._
77
77
78
78
A student should be able to:
79
79
80
-
1. Explain the differences between the big five, namely, copy constructor, move constructor, copy/assign, move/assign, destructor, and constructor.
80
+
1. Explain the differences between the big five, namely, copy constructor, move constructor, copy/assign, move/assign, destructor, and constructor, see [move semantics](move-semantics.md)
81
81
2. Construct a initializer list and explain conditions when it is necessary
82
82
3. Delegate to the constructor of the base class
83
83
4. Demonstrate and explain safe memory handling using shared or unique pointers
84
84
5. Define what RAII is, the role of the constructor in it; and the relationship with its destructor
85
+
6. Use the explicit keyword to prevent accidental type conversion from a single argument, see [C.46](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-explicit)
86
+
7. Initialze data members with default values outside of the constructor and explain the benefit of why, see [C.48](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-explicit)
85
87
86
88
#### Caveats
87
89
@@ -101,12 +103,9 @@ For more details, we refer to the [C++ core guidelines](https://isocpp.github.io
101
103
_These are important topics that are not expected to be covered but provide
102
104
guidance where one can continue to investigate this topic in more depth._
103
105
104
-
* Member references must be initialized in the constructor
105
-
* Member classes not initialized explicitly will be initialized using the default constructor
106
-
* Exceptions thrown in constructor (needs to be extended)
107
-
* Protected constructor prevents direct construction of a base class
108
-
* Explicit constructor prevents implicit type conversion of a single argument
109
-
* Member classes are constructed in the order they are declared
106
+
* Initialization requirements of data members not explicitly initialized via the initializer-list or NSDMIs, including references and non-trivial types
107
+
* Exceptions thrown in constructor, see [Execption handling](../error-handling/exception-handling.md)
108
+
* Protected constructor prevents direct construction
110
109
* Constructors for classes with static members must be defined outside of the body of the class
111
-
* Non-state data member can be given a default value at initialization, but constructor take
110
+
* Non-static data member can be given a default value at initialization, but constructor take precedence
0 commit comments