C++: Operators and Type Conversion with Constructors
Channel:
Subscribers:
2,650
Published on ● Video Link: https://www.youtube.com/watch?v=AI0uTkkYkUU
Today we made a capital-I Integer class that behaves like a normal int in C++ but it cannot ever be uninitialized. C++ allows you to add operators to a type so that you can do things like + and - with it.
Constructors are used in C++ not only for creating new objects, but are also used to implicitly convert between types as well, unless you use the explicit keyword in front of them.
Finally, we talked a bit about friend functions, and how you can mark something as a friend to get access to the private member variables and functions inside of a class that they normally wouldn't have access to. I use it mostly to package global functions inside of a class to make it look tidier.
Other Videos By Bill Kerney
2024-02-28 | C++: Dynamic Cast |
2024-02-28 | CSCI 1: Fallacies and Midterm I Review |
2024-02-26 | C++ Circular Lists, Sentinel Nodes, Merging Lists |
2024-02-26 | C++: Keywords You Might Not Know |
2024-02-23 | C++ Inheritance |
2024-02-21 | C++ Smart Pointers |
2024-02-14 | C++: Inserting into a Linked List |
2024-02-12 | C++: Debugging Linked Lists using Invariants |
2024-02-09 | Lab Time: Make a Makefile |
2024-02-07 | C++ Linked Lists |
2024-02-05 | C++: Operators and Type Conversion with Constructors |
2024-02-03 | C++ Test Driven Development using Gtest |
2024-02-03 | Managing Computer Science Projects is Hard |
2024-01-31 | Big O Notation |
2024-01-31 | C++ Operators |
2024-01-29 | C++ Timing Code, Benchmarking, UNIX Shell Scripting Automation |
2024-01-26 | Make a Makefile |
2024-01-24 | C++: Adding Iterator Support to our Vector Class |
2024-01-22 | C++ Rule of 3/5 and Vectors |
2024-01-22 | C++ Compiler Flags for Development |
2024-01-17 | Installing a Nerd Font on Windows |