Перейти к содержимому

How to Solve the Class Question Step by Step | C++ OOP Midterm

Eng. M sobhy

0:00 / 0:00

How to Solve the Class Question Step by Step | C++ OOP Midterm

421 просмотр · 3 дн. назад
Eng. M sobhy
105 подписчиков
421 просмотр · 3 дн. назад
Midterm review for Programming (2): Object-Oriented Programming in C++. In this video we review everything you need for the midterm: classes and objects, public vs private, setters and getters, the this pointer, constructors, destructors, and the order they are called. Then we solve a full exam-style question step by step, and go through the most common mistakes that cost marks. Open Visual Studio and code along with me. Don't just watch. ⏱️ Chapters 0:00 Introduction 2:00 Why OOP? 4:00 Class & Object 10:00 public vs private 13:00 Setters & Getters (with validation) 18:00 The this pointer trap 21:00 Constructors (default, parameterized, overloading) 30:00 Destructor & call order 37:00 Solving an exam question step by step 48:00 Integer division trap 50:00 Top 10 mistakes 53:00 Exam tips 📝 After watching: Solve Worksheet 1 on your own, then compare with the solution. 📌 Key rules to remember: • Attributes are private, methods are public • Constructor: same name as the class, no return type • Destructor: ~ClassName(), no parameters, only one • Objects are destroyed in reverse order of creation • Use the this pointer when the parameter has the same name as the attribute If anything is not clear, leave a comment below. Good luck in the midterm! 🍀 #cpp #OOP #programming #midterm #cplusplus #classes #constructors