0% found this document useful (0 votes)
11 views

Intro To Classes and Objects

This module introduces the concepts of classes and objects in object-oriented programming. It discusses how software can be implemented as interacting objects, with each object having state, behavior, and identity. The state of an object is stored in fields, its behavior is accessed through methods, and its identity distinguishes it from other objects of the same class. Classes define the common properties and behaviors of objects, acting as templates for object creation.

Uploaded by

Luca Kab
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Intro To Classes and Objects

This module introduces the concepts of classes and objects in object-oriented programming. It discusses how software can be implemented as interacting objects, with each object having state, behavior, and identity. The state of an object is stored in fields, its behavior is accessed through methods, and its identity distinguishes it from other objects of the same class. Classes define the common properties and behaviors of objects, acting as templates for object creation.

Uploaded by

Luca Kab
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Module 4

Classes and Objects



Lecture
Intro to Classes and Objects

Module 4 Learning Objectives


In this module, well talk about the foundational
concepts in the Object-Oriented paradigm
The big idea: software can be implemented as a
set of interacting objects
Examples of interacting entities in the game
world

In-Lecture Quiz

Which of the following is NOT one of the things an
object has

A: State
B: Country
C: Behavior
D: Identity


State
Characteristics of the
object
Behavior
What we can do to the
object
What we can tell the
object to do to itself
Identity
So we can distinguish one
object from another
Memory address
Playing Card
State: rank, suit, face up or
not
Stored in fields
Accessed through
properties
Behavior: flip over
Accessed through
methods
Identity: when we create a
new card object
(instantiation)
In-Lecture Quiz

We store the state of an object in

A: meadows
B: pastures
C: fields
D: pocketses


Class
Template for creating objects
Defines the fields, properties,
and behavior of every object
of the class
Object
Actual instance of the class in
memory
Each object stores its own
state
Different card objects
have different ranks and
suits, for example
In-Lecture Quiz

UML stands for

A: Unlikely Macho Leeroy
B: Unfathomable Mathematical Lemma
C: Integrated Development Environment
D: Unified Modeling Language




Before we finish off this lecture, note that classes
are reference types, not value types
The ones and zeros at the memory location
allocated to the variable arent the value of the
variable, theyre a reference to the location in
memory where the actual object is


Recap
OO provides classes (reference types in C#) we can
use to create objects
Objects interact with each other to implement our
game
Next Time
Well start using classes and objects in C#

You might also like