Chapter 10 classes and objects a deeper look
This presentation is the property of its rightful owner.
Sponsored Links
1 / 44

Chapter 10 Classes and Objects: A Deeper Look PowerPoint PPT Presentation


  • 80 Views
  • Uploaded on
  • Presentation posted in: General

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.

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Chapter 10 classes and objects a deeper look

Chapter 10Classes and Objects: A Deeper Look


C lasses

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


10 2 time class case study

10.2 Time Class Case Study


Chapter 10 classes and objects a deeper look

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

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


Chapter 10 classes and objects a deeper look

Class

publicA

protectedB

internal C

privateD

Class

publicA

protected B

internal C

privateD

SubClass

(outside package)

publicA

protectedB

internal C

privateD

SubClass

publicA

protected B

internal C

privateD

privateD

Class

(outside package)

publicA

protectedB

internal C

privateD

ASSEMBLY


10 3 controlling access to members

10.3 Controlling Access to Members


10 4 referring to the current object s members with the this reference

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


10 5 time class case study overloaded constructors

10.5 Time Class Case Study: Overloaded Constructors

It's the marker for Inheritance and/or the constructor call chain.


10 6 default and parameterless constructors

10.6 Default and Parameterless Constructors


10 7 composition

10.7 Composition


10 8 garbage collection and destructors

10.8 Garbage Collection and Destructors


10 9 static class members

10.9 static Class Members


What is the difference between const and static readonly

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.


10 10 readonly instance variables

10.10 readonly Instance Variables


10 11 data abstraction and encapsulation

10.11 Data Abstraction and Encapsulation


10 12 class view and object browser

10.12 Class View and Object Browser


  • Login