✏️ تعديل: Classes and Objects
تعديل محتوى الموضوع
→ رجوع للموضوع
عنوان الموضوع
التصنيف
التاقات (مفصولة بفاصلة)
ملاحظة التعديل (اختياري)
المحتوى
أنت بتتعامل مع أشياء الفرق بين الاوبجيكت والكلاس أنت بتصنف الكود Student Course Poctor Employee Major Collage Department Others فأنت كده عملت classvication **The relationship between Class and Object** Exactly, you got the idea right. Let me explain it: **The Class (the category / classification):** it's the template or blueprint. When you say `Student`, `Course`, or `Employee`, you are creating a classification — you define a type of thing along with its properties and behavior, but it's just an idea/template, not a real thing existing in memory. **The Object (the instance):** it's a real instance of the class, actually existing in memory and having values. An example to show the difference: ```cpp class Student // ← Class: the classification / the template { public: string Name; int Age; string Major; }; int main() { Student Student1; // ← Object: a real object Student1.Name = "Ahmed"; Student1.Age = 20; Student1.Major = "CS"; Student Student2; // ← Another Object from the same Class Student2.Name = "Sara"; Student2.Age = 22; Student2.Major = "IT"; } ``` A simple analogy: - `Student` = the word "student" in a dictionary (a general concept). - `Student1` and `Student2` = Ahmed and Sara (real people, each one with their own data). So the words you wrote (`Student`, `Course`, `Doctor`, `Employee`, `Major`, `College`, `Department`...) are all classes — classifications. And when you create actual instances from them with values, those instances become objects. An important point: from a single class you can create an unlimited number of objects, and each object is independent in its values from the others.
👁️ معاينة فورية
💡 كل بلوك قابل للسحب والترتيب. يدعم
Markdown
:
## عنوان
·
**bold**
·
- قائمة
·
```dart code```
·
[[اسم الموضوع]]
💾 حفظ التعديلات