1 / 44

Chapter 10 Classes and Objects: A Deeper Look

Chapter 10 Classes and Objects: A Deeper Look. C lasses. Classes are not just containers for methods Virtually all are classes Blueprint/Cookie Cutter/Recipe Objects – instance of the class (new) Type “prop” tab tab OOP – vast topic. 10.2 Time Class Case Study.

penha
Download Presentation

Chapter 10 Classes and Objects: A Deeper Look

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 10Classes and Objects: A Deeper Look

  2. Classes • Classes are not just containers for methods • Virtually all are classes • Blueprint/Cookie Cutter/Recipe • Objects – instance of the class (new) • Type “prop” tab tab • OOP – vast topic

  3. 10.2 Time Class Case Study

  4. Formatting: http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx Padding: http://msdn.microsoft.com/en-us/library/txafckwd.aspx

  5. Class public A protected B internal C private D Class public A protected B internal C private D SubClass (outside package) public A protected B internal C private D SubClass public A protected B internal C private D private D Class (outside package) public A protected B internal C private D ASSEMBLY

  6. 10.3 Controlling Access to Members

  7. 10.4 Referring to the Current Object’s Members with the this Reference

  8. 10.5 Time Class Case Study: Overloaded Constructors It's the marker for Inheritance and/or the constructor call chain.

  9. 10.6 Default and Parameterless Constructors

  10. 10.7 Composition

  11. 10.8 Garbage Collection and Destructors

  12. 10.9 static Class Members

  13. What is the difference between constand static readonly? • static readonly field is set at run time, and can thus be modified by the containing class • the value of a const field is set to a compile time constant. • In the staticreadonlycase, the containing class is allowed to modify it only in the variable declaration (through a variable initializer) in the static constructor (instance constructors, if it's not static) • staticreadonlyis typically used if the type of the field is not allowed in a const declaration, or when the value is not known at compile time. • Instancereadonly fields are also allowed.  • Remember that for reference types, in both cases (static and instance) the readonly modifier only prevents you from assigning a new reference to the field.  It specifically does not make immutable the object pointed to by the reference.

  14. 10.10 readonly Instance Variables

  15. 10.11 Data Abstraction and Encapsulation

  16. 10.12 Class View and Object Browser

More Related