copy constructor syntax
This commit is contained in:
committed by
JamesFlare1212
parent
1aace1130f
commit
237db36f55
@@ -80,6 +80,12 @@ will sort Date objects into chronological order.
|
||||
<!-- - Copy constructors are automatically generated by the compiler if you do not provide one explicitly. However, if your class uses dynamic memory (which will be covered in next lecture), and you want a copy constructor, then you must write your own copy constructor.-->
|
||||
- Copy constructors get called when you create a new object by copying an existing object using the assignment operator (=), or when you pass an object by value to a function.
|
||||
|
||||
### Copy Constructor Syntax
|
||||
|
||||
```cpp
|
||||
ClassName(const ClassName& other);
|
||||
```
|
||||
|
||||
### Copy Constructor Example
|
||||
|
||||
```cpp
|
||||
|
||||
Reference in New Issue
Block a user