الشرح التفصيلي لجميع شرائح المحاضرة (Slide-by-Slide) مدعوم بشرح الأكواد سطراً بسطر والتريكات الهامة
1. Which of the following is considered one of the "Fatal Flaws" of Linear (Sequential) Programming?
2. What is the correct chronological order of the evolution of programming paradigms?
1. Every Object is characterized by three essential elements. What are they?
2. Based on the OOP equation mentioned in the lecture, what does (Related Data + Related Functions) result in?
1. In a UML Class Diagram, the class box is divided into three compartments. What is the correct order from top to bottom?
2. What is the role of the private access modifier in a C++ class definition?
private modifier enforces Encapsulation by hiding internal state and protecting it from unauthorized access.
3. What is the required syntax to correctly terminate a class definition in C++?
};.
1. In C++, which file is typically used to write the actual body and details (Implementation) of class methods?
.cpp file contains the method definitions/implementation, while the .h file contains only the declarations (interface).
2. What is the name of the operator used to define a method outside its class declaration, visually represented as (::)?
3. In a UML Class Diagram, what does the minus sign (-) before a variable name denote, and what is its C++ equivalent?
- تعني private (حماية الداتا)، وعلامة + تعني public (للدوال المتاحة للاستخدام الخارجي).; في نهاية تعريف الـ Class قبل الـ Main، بدونها البرنامج مش هيعمل Compile.::: ده المعامل اللي بيربط بين الدالة المكتوبة في ملف الـ .cpp والكلاس الأصلي المكتوب في ملف الـ .h.Question: Discuss the main differences between Procedural Programming and Object-Oriented Programming (OOP). Explain why OOP is considered a better approach for large and complex software systems.
Q1: What is the output of the following code?
Q2: What is the output of the following code?
Q1: Declare a class called Student with a private integer member called id and a public function called setId.
Q2: Create an object called s1 from the class Student, then call the function setId with the value 101.
Q3: Define the function getGrade() of class Student OUTSIDE the class using the Scope Resolution Operator.
a) What are the private data members of the class?
b) How many member functions does the class have? List them.
c) What is the output of the program?
d) Can we write cout << r.length; inside main()? Explain why.