Chapter 10 classes and objects a deeper look
Download
1 / 44

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


  • 109 Views
  • Uploaded on

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.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Chapter 10 Classes and Objects: A Deeper Look' - penha


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



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

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


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




10 5 time class case study overloaded constructors
10.5 Time Class Case Study: this ReferenceOverloaded Constructors

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


10 6 default and parameterless constructors
10.6 Default and this ReferenceParameterless Constructors


10 7 composition
10.7 Composition this Reference



10 9 static class members
10.9 this Referencestatic Class Members


What is the difference between const and static readonly
What is the difference between this Referenceconstand 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 this Referencereadonly Instance Variables




ad