Presentation is loading. Please wait.

Presentation is loading. Please wait.

C++ Programming L11 . Classes(3) kkkkkkkkkkkkkk

Similar presentations


Presentation on theme: "C++ Programming L11 . Classes(3) kkkkkkkkkkkkkk"— Presentation transcript:

1 C++ Programming L11 . Classes(3) kkkkkkkkkkkkkk
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

2 الصفوف Classes : Composition . Friends Function . Friends Classes .
kkkkkkkkkkkkkk الصفوف Classes : Today Outlines Composition . Friends Function . Friends Classes . This Pointer . Static Members . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

3 الصفوف Classes ـ Composition :
kkkkkkkkkkkkkk الصفوف Classes ـ Composition : يستخدم المصطلح Composition عندما يكون لدينا صف يحوي في الـ data members أغراض من صفوف أخرى . تدعى أيضاً بعلاقة has-a أي علاقة ملكية . أمثلة : Car has a wheel فيكون لدينا صف Car يحوي بداخله غرض من الصف Wheel . Person has a birthday فيكون لدينا صف Person بداخله غرض من الصف Date . Room has a Table فيكون لدينا صف Room بداخله غرض من الصف Table . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

4 الصفوف Classes ـ Composition :
kkkkkkkkkkkkkk الصفوف Classes ـ Composition : عند إنشاء غرض من الصف Person والذي يحوي بداخله غرض من الصف Date فإنه ينبغي علينا تمرير instance of date إلى باني الصف Person . الآن سوف نقوم بعرض مثال يحوي : الصف Date . الصف Person والذي يحوي بداخله غرض من الصف Date يمثل تاريخ الميلاد لهذا الشخص . انتبه جيداً على آلية استدعاء الـ Constructors . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

5 الصفوف Classes ـ Composition :
kkkkkkkkkkkkkk الصفوف Classes ـ Composition : هنا لدينا الصف Date يحوي الباني والهادم والباني الناسخ ويحوي أيضاً method يقوم بعملية طباعة المحتوى. تنفيذذذذذذذ © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

6 الصفوف Classes ـ Composition :
kkkkkkkkkkkkkk الصفوف Classes ـ Composition : هنا لدينا الصف Person يحوي الباني والهادم ويحوي أيضاً method يقوم بعملية طباعة المحتوى. لاحظ أن تابع الطباعة هنا يقوم باستدعاء تابع الطباعة الموجود في الصف Date تنفيذذذذذذذذذذذذذذذ © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

7 الصفوف Classes ـ Composition :
kkkkkkkkkkkkkk الصفوف Classes ـ Composition : لاحظ أننا استخدمنا Member initialization list في إعطاء القيم لـ Birthday . تنفيذ******************* © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

8 الصفوف Classes ـ Composition :
kkkkkkkkkkkkkk الصفوف Classes ـ Composition : الآن لنعيد نفس المثال السابق ولكن فقط بتغيير ترويسة الباني للصف Person لتصبح بالشكل التالي : أي أنه هنا تم تمرير الغرض birth بالعنوان فهل سيتغير الخرج عند إجراء هذا التعديل البسيط وهو وضع & فقط ؟؟؟ تنفيذ******** © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

9 الصفوف Classes ـ Composition :
kkkkkkkkkkkkkk الصفوف Classes ـ Composition : لاحظ أننا في المثالين السابقين قمنا بتهيئة الغرض Birthday الموجود في الصف Person عن طريق Member Initialization List . قم بإعادة كتابة نفس المثال ولكن بتهيئة الغرض Birthday الموجود في الصف Person وفقاً للطريقة العادية أي كتابة الباني بالطريقة الأولى من دون استخدام Member Initialization List . ما الفرق ؟ باختصار : عندما يكون لدينا عملية Composition فإنه يفضل تهيئة الغرض الضيف في باني المضيف عن طريق Member Initialization List ، وإذا كان لدينا في الصف الضيف مؤشرات فإنه ينبغي كتابة Deep Copy Constructor فيه وذلك لأن Member Initialization List تقوم باستدعاء الباني الناسخ كما رأينا في الأمثلة السابقة. تنفيذ************* © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

10 الصفوف Classes ـ Friends Functions :
kkkkkkkkkkkkkk الصفوف Classes ـ Friends Functions : نحن نعلم أنه لا يمكننا تعديل الـ private members من خارج الصف بشكل مباشرة . يمكننا فعل ذلك عن طريق توابع أعضاء ضمن الصف وتدعى بالـ Set Method والتي نقوم بالتصريح عنها على أنها Public. ويمكن أيضاً فعل ذلك عن طريق توابع ليست أعضاء ضمن الصف وتدعى friends function التوابع الصديقة. التوابع الصديقة لصف ما تكون قادرة على رؤية الـ private data members . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

11 الصفوف Classes ـ Friends Functions :
kkkkkkkkkkkkkk الصفوف Classes ـ Friends Functions : Compiler Error لا يمكن الوصول إلى الـprivate data member من خارج الصف . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

12 الصفوف Classes ـ Friends Functions :
kkkkkkkkkkkkkk الصفوف Classes ـ Friends Functions : نقوم بإضافة ترويسة التابع الصديق ضمن الصف © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

13 الصفوف Classes ـ Friends Functions :
kkkkkkkkkkkkkk الصفوف Classes ـ Friends Functions : عند كتابة تابع صديق لصف ما نكتب الكلمة المفتاحية friend في بداية الـ header للتابع . تذكر أن التابع الصديق ليس تابع عضو في الصف وإنما هو تابع global . يمكن كتابة التابع الصديق مباشرة ضمن الصف مباشرة أي كتابة الـ header والـ Body . ويمكن أيضاً كتابة الـ header فقط في الصف ويتم كتابة الـ Body خارج الصف ولكن في هذه الحالة عند كتابة الـ header نقوم بكتابة الكلمة المفتاحية friend قبل تعريف التابع الصديق أما عند كتابة الـ Body لا نقوم بكتابة الكلمة المفتاحية friend ولا نستخدم المعامل Scope Resolution Operator لأن التابع الصديق ليس تابع عضو في الصف . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

14 الصفوف Classes ـ Friends Classes:
kkkkkkkkkkkkkk الصفوف Classes ـ Friends Classes: يمكننا تعريف أن صف A هو صديق للصف B وبالتالي جميع التوابع الأعضاء الموجودة ضمن الصف A يمكنها رؤية المتحولات والمنهجيات الـ private الموجودة في الصف B . حتى يكون الصف A صديق للصف B يجب أن يصرح الصف B بذلك بكتابة السطر التالي داخل الصف B : friend class A ; إذا كان الصف A صديق للصف B فإن B ليس من الضروري أن يكون صديق لـA . إذا كان A صف صديق لـ B و B صف صديق لـ C فإن A ليس صف صديق لـ C . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

15 الصفوف Classes ـ Friends Classes:
kkkkkkkkkkkkkk الصفوف Classes ـ Friends Classes: © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

16 الصفوف Classes ـ This Pointer:
kkkkkkkkkkkkkk الصفوف Classes ـ This Pointer: ذكرنا سابقاً أن المؤشر this هو مؤشر يشير إلى الغرض الذي يستدعي حالياً . يمكننا الوصول إلى الـdata member عن طريق this-> أو عن طريق (*this). إن *this.x = *(this.x) حيث يكون x هو مؤشر . إن *this.x != (*this).x حيث أن (*this).x تعني الوصول إلى الـ data member الذي اسمه x مهما كان نوعه . نستنتج من الملاحظتين السابقتين أن النقطة لها أولوية أعلى من الـ * . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

17 الصفوف Classes ـ This Pointer: مثال (1):
kkkkkkkkkkkkkk الصفوف Classes ـ This Pointer: مثال (1): © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

18 الصفوف Classes ـ This Pointer: مثال (2):
kkkkkkkkkkkkkk الصفوف Classes ـ This Pointer: مثال (2): يمكننا استخدام ما يسمى الاستدعاء المتتالي للتوابع الأعضاء وذلك بالاستفادة من المؤشر this لاحظ المثال التالي انتبااااااااااااااااااه Point P3=point(); // Correct Point P2(); // Compiler Error © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

19 الصفوف Classes ـ This Pointer: مثال (2):
kkkkkkkkkkkkkk الصفوف Classes ـ This Pointer: مثال (2): هنا نقوم بجعل كل تابع عضو يرد محتوى الغرض الحالي وذلك بالاستفادة من المؤشر this . انظر إلى كيفية الاستدعاء المتتالي للتوابع الأعضاء فيmain function . تسمى العملية السابقة بـ cascaded methods calls . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

20 الصفوف Classes ـ Static Members:
kkkkkkkkkkkkkk الصفوف Classes ـ Static Members: عندما نقوم بتعريف صف ما يحوي العديد من الـ data members ، ثم نقوم بعدها بإنشاء أغراض من هذا الصف وكل غرض يحوي قيم مختلفة عن الآخر ، هنا يكون قيم الـ data members في كل object تختلف عن قيمها في الأغراض الأخرى أي أن كل غرض له data members مختلفة عن الآخر . وبالتالي يمكننا القول بأن الـ data members هي ملك للغرض وليست ملك للصف . يمكننا تعريف data members على أن تكون ملك للصف نفسه وذلك باستخدام الكلمة static وهنا يشترك جميع الأغراض فيما بينها بالوصول لهذا الـstatic data member ونختصر أيضاً بالقول بأن الـ static data member هو ملك للصف وليس ملك لغرض معين . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

21 الصفوف Classes ـ Static Members:
kkkkkkkkkkkkkk الصفوف Classes ـ Static Members: الـ static data member يمكن أن يكون public , private , protected . الـ static data member هو ملك للصف يتم إنشاءه مرة واحدة عند تعريف الصف . إن الـ static data member يتم إنشاءه عند إنشاء الصف حتى إن لم نقوم بإنشاء أي غرض . الـ static data member يجب إعطاءه قيمة ابتدائية ولكن أين ؟؟ الباني ؟؟ بالتأكيد ليس في الباني والسبب في ذلك بأن الباني يتم استدعاءه عند إنشاء كل غرض . نقوم بتهيئته مرة واحدة خارج الصف في الـ global section باستخدام الـ scope resolution operator . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

22 الصفوف Classes ـ Static Members: مثال(1) :
kkkkkkkkkkkkkk الصفوف Classes ـ Static Members: مثال(1) : Public تنفيذ************* © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

23 الصفوف Classes ـ Static Members:
kkkkkkkkkkkkkk الصفوف Classes ـ Static Members: من المثال السابق نلاحظ التالي : يتم تهيئة الـ public static data member عن طريق :: في الـ global section . يتم الوصول إليه عن طريق اسم الصف من خلال ClassName::HisName كما يمكن الوصول إليه عن طريق أي غرض من خلال ObjectName.HisName لقد قمنا باستخدام الـ public static data member من أجل عدّ الأغراض المنشأة من الصف . عند إنشاء غرض ما فلا يتم إنشاء الـ public static data member وإنما يتم إنشاءه مرة واحدة فقط عند تعريف الصف . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

24 الصفوف Classes ـ Static Members: مثال(2) :
kkkkkkkkkkkkkk الصفوف Classes ـ Static Members: مثال(2) : Private تنفيذ****************** © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

25 الصفوف Classes ـ Static Members:
kkkkkkkkkkkkkk الصفوف Classes ـ Static Members: من المثال السابق نلاحظ التالي : يتم تهيئة الـ private static data member عن طريق :: في الـ global section . يتم الوصول إليه عن طريق public static method سواء من خلال اسم الصف أو من خلال غرض منه. لا يمكن الوصول إليه مباشرة دون استخدام public method مساعد . لقد قمنا باستخدام الـ private static data member من أجل عدّ الأغراض المنشأة من الصف . عند إنشاء غرض ما فلا يتم إنشاء الـ private static data member وإنما يتم إنشاءه مرة واحدة فقط عند تعريف الصف . © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

26 الصفوف Classes ـ Static Members:
kkkkkkkkkkkkkk الصفوف Classes ـ Static Members: non static method يمكنه الوصول إلى static members . يمكنه الوصول إلى non static members. يملك this pointer . static method يمكنه الوصول إلى static members . لا يمكنه الوصول إلى non static members. لا يملك this pointer . يجب فهم هذا الجدول..... لا تقم بحفظه أبداً © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

27 الصفوف Classes ـ Static Members: مثال (3):
kkkkkkkkkkkkkk الصفوف Classes ـ Static Members: مثال (3): تنفيذ******************* © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

28 The End kkkkkkkkkkkkkk
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.


Download ppt "C++ Programming L11 . Classes(3) kkkkkkkkkkkkkk"

Similar presentations


Ads by Google