Description
In this course, you will :
- Learn about the C++ keyword const and its behaviour in various contexts, such as local, global, and static contexts.
- This course will teach you about const and its implications when returning pointers and references in C++.
- You will have a firm grasp on const and its application in preventing any unintentional data changes.
- Use of const with variables
- Effect of const on functions and return types
- Const with parameters
- Relation between const and smart pointers
Syllabus :
1. Arguments using const
- Arguments Against const
- const and Visual Noise
- How const may Confuse Developers
- Why does const matter?
- Key Takeaways
2. Local Variables
- const Local Variables
- Key Takeaways
3. Local Members
- const with Member Variables
- Unexpected Implications
- Find a Workaround
- Move Semantics
- Key Takeaways
4. Functions
- const Functions
- const Overloads
- Key Takeaways
5. Return Types
- const Return Types
- Returning const References
- Return const Pointers
- int * const func() const
- const int * func() const
- Key Takeaways
6. const Parameters
- const Primitive Data Type
- const Class Type Parameters
- Ignoring the const
- const Qualifier
- Key Takeaways
7. const and Smart Pointers
- Smart Pointers as Pointers
- Smart Pointers as Objects
- Key Takeaways
8. Rvalue References
- const Rvalue References
- Binding Rules
- Use of const Rvalue References
- Key Takeaways