Skip to content

Commit b9f99c7

Browse files
committed
Final draft
1 parent 6b410b5 commit b9f99c7

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

sources/modules/object-model/constructors.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Advanced: TBD
2424
_Why is this important?_
2525
_Why do we want to learn/teach this topic?_
2626

27-
Constructors are fundamental to generate objects from classes and structs, so understanding them is essential to work with objcets.
27+
Constructors are fundamental to generate objects from classes and structs, so understanding them is essential to work with objects.
2828

2929
### Topic introduction
3030

@@ -77,11 +77,11 @@ implementation-defined, unspecified, or undefined behavior._
7777

7878
A student should be able to:
7979

80-
1. Explain the differences between the big five, namely, copy constructor, move constrcutor, 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.
8181
2. Construct a initializer list and explain conditions when it is necessary
8282
3. Delegate to the constructor of the base class
8383
4. Demonstrate and explain safe memory handling using shared or unique pointers
84-
5. Define what RAII is and the role of the constructor
84+
5. Define what RAII is, the role of the constructor in it; and the relationship with its destructor
8585

8686
#### Caveats
8787

@@ -90,20 +90,23 @@ A student should be able to:
9090
#### Points to cover
9191

9292
* Not calling virtual functions from the base class
93-
* Do not initialze data outside of the constructor (two face initialization)
93+
* Do not initialize data outside of the constructor (two face initialization)
94+
* All objects should be initialized within the constructor and should have a well-defined state
9495
* Difference between assignment and deep copy
9596

97+
For more details, we refer to the [C++ core guidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines)
98+
9699
### Advanced:
97100

98101
_These are important topics that are not expected to be covered but provide
99102
guidance where one can continue to investigate this topic in more depth._
100103

101-
* Error handling within constructors
102-
* Non-static data initialziers
103-
* Constructors with member references
104-
* Purposes for protected constructors
105-
* What does delete vs private means
106-
* What does it mean to have an explicit constructor
107-
* Impact on const expr on constructor %extend later
108-
* Rules on memory ordering %extend later
109-
* Define constructor outside of the body of the class %extend later
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
110+
* 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
112+

0 commit comments

Comments
 (0)