SlideShare a Scribd company logo
Introduction to
OOP Concepts
BY: SAMUEL ANSONG
Pre-Requisites
• Familiarity with functions and types
• Basic understanding of a class
• Has an overall Introduction to programming
• We will be using C# for code samples
Pre-Requisite Check
1. Write a simple function to add all numbers in the array below
int [] array = new int[] {2,4,5,6,7,8,8,9,0,10,5,7}
Hint
<visibility> <return type> <name>(<parameters>)
{
<function code>
}
You can logon Here -> C# Online Compiler | .NET Fiddle (dotnetfiddle.net) and complete your
code.
Answer and Modification
1. Overload the function to take 3 numbers
2. Overload the method to take any amount of numbers
3. Change the function into a lambda format
Structure
Procedural Oriented Programming Overview
Limitations of POP
Object Oriented Programming Overview
• Encapsulation
• Inheritance
• Polymorphism
• Abstraction
Core Components
• Access Modifiers
• Static Class and Methods
Key Terms
Procedural Oriented Programming
• C , Pascal, FORTRAN, and similar languages are procedural languages
• Each Statement in the language tells the computer to do something
• Get some Input
• Add these numbers
• Divide by 4
• Display the number
A program in a procedural language is a list of
instructions
Divided Into Functions
• Procedural program is divided into functions
• Each function has clearly defined purpose and how it interfaces with other
functions in the program
• One can also further extend functions by grouping several functions together
into a larger entity called Modules .
Divided Into Functions
• In Multi-Function program important data items
are placed as Global so that they maybe
accessed by all functions
• Each function may also have its own local data
Limitations for POP
• Since all functions have accessed to the Global Variable , new functions
accidentally created can corrupt the data
• We can access the data of one function from other since there is no
protection
• In a large program it is difficult to trace what data is used by which function
• If new data is added , all the functions are to be modified to access this data
Object Oriented Programming
• OOP was introduced to overcome flaws in the procedural
approach to programming
• Such as lack of Reusability and Maintainability
• The Fundamental idea behind OOP is to combine into a
single unit both data and functions that operate on them.
• Such a unit is called an Object .
Objects?
In the real world, just about anything can be seen as an object:
car, dog, person, department, city, etc. These
have state and behavior. For example, a dog's state is its color,
breed and name; its behavior is the way it barks, runs or wags its
tail. Objects in OOP are quite similar
Example
Identify the Properties (State) and Behavior
(Methods) of Your Bicycle
Objects Continued…..
Object Oriented Programming
• In OOP, problem is divided into number of entities called objects
and then builds data and functions around these objects
• It ties the data more closely to the functions that operate it and
protects it from accidental modification from the outside functions
• Data of an object can only be accessed by the functions associated
with that object
• Communication of the objects done through functions.
Classes
• Classes are user-defined data types
• Objects are variables of a class
• Once a class has been defined, we can create any number of
objects from the Class
• A class thus can be said as a collection of similar objects of same
type.
Example
• Let us consider a software that involves renting cars.
• We can have a class and objects as below
Example
Let us consider a software that involves a zoo.
What are some of the classes and objects to be
created .
Answer
Core Concepts
Encapsulation
• Encapsulation is the first pillar or principle of object-oriented
programming
• In simple words, “Encapsulation is a process of binding data
members (variables, properties) and member
functions(methods) into a single unit”
• And a Class is the best example of encapsulation
• Data Hiding from all external Classes
Encapsulation
Encapsulation in Real Life
•Has prescription
•Does not have direct
contact to the medicines
Patient
•Has Access to the medicine
•Returns the right medicine
•Reduces risk of you getting
wrong medicine
Chemist •Can only be accessed by
chemists
•Several medicines available
for different treatments
Medicines
Encapsulation in OOP
•Has no direct access to
data in the medicine class
External
Classes
•Controls access and
manipulation of data in the
medicine class
•They are wrapped in the
class
Functions •Medicine Class
•Contains both member
functions and Variables
•Determines how accessible
the data is to outside world
Medicines
Encapsulation in OOP
So, Encapsulation means hiding the important features
of a class which has no usefulness being
exposed to outside of the class and exposing only the
necessary things of the class.
Abstraction
Abstraction is about describing something at a
conceptual level while leaving out the details.
example, we may talk about a vehicle without
being explicit if it's a ship or a car.
Example of Abstraction
When using the tv remote control, you do not
bother about how pressing a key in the remote
changes the channel on the TV. You Just know
that pressing the “+” volume button will increase
the volume.
Example of Abstraction
• A class can be abstract as well meaning , it can provide you
functions without their implementation
• For example, if our class was a remote control , it will give
us the method IncreaseVolume() without details of how It
will be done . Such a method is called an abstract method
Example of Abstraction
• You cannot instantiate this class
Animal myObj = new Animal(); // Will generate an
error
• You can only Inherit this class
Inheritance
• The mechanism of deriving a new class from an old class is called
inheritance or derivation
• The Old class is known as base class while new class is known as
derived class or sub class
• Inheritance is the most powerful feature of OOP.
• Gives the sub class access to methods of based class
Example
If a child is as Tall as his dad and Fair as his mom
, we usually say the child has inherited these
features from his father and mother.
Example
using System;
namespace MyApplication
{
class Vehicle // Base class
{
public string brand = "Ford"; // Vehicle field
public void honk() // Vehicle method
{
Console.WriteLine("Tuut, tuut!");
}
}
}
• The Base class here is Vehicle
• It has Properties (Brand) and an implemented
Method honk
Example
using System;
namespace MyApplication
{
class Car : Vehicle // Derived class
{
public string modelName = "Mustang"; // Car field
}
}
• The Base class here is Vehicle
• The Car class is inheriting the vehicle class and thus
Will have access to the honk method in the Vehicle class.
• Inheritance is shown by the “:” sign . Colon.
Example Code Snippet
using System;
namespace MyApplication
{
class Program
{
static void Main(string[] args)
{
// Create a myCar object
Car myCar = new Car();
// Call the honk() method (From the Vehicle class) on the myCar object
myCar.honk();
// Display the value of the brand field (from the Vehicle class) and the value of the modelName from the Car class
Console.WriteLine(myCar.brand + " " + myCar.modelName);
}
}
}
Inheritance
• Through Effective use of inheritance , you can save a lot of time in your
programming and reduces errors
• This will also increase the quality of the work and productivity
Polymorphism
• Polymorphism means "many forms", and it occurs
when we have many classes that are related to each
other by inheritance
• Inheritance lets us inherit fields and methods from
another class. Polymorphism uses those methods
to perform different tasks. This allows us to perform
a single action in different ways.
Example
For example, think of a base class called Animal that
has a method called animalSound(). Derived classes of
Animals could be Pigs, Cats, Dogs, Birds - And they
also have their own implementation of an animal
sound (the pig oinks, and the cat meows, etc.):
Example
class Animal // Base class (parent)
{
public void animalSound()
{
Console.WriteLine("The animal makes a sound");
}
}
class Pig : Animal // Derived class (child)
{
public void animalSound()
{
Console.WriteLine("The pig says: wee wee");
}
}
Next Lecture
Object Oriented Programming Implementation
Building a Game with C#
Unity 3D and C#
• Encapsulation
• Inheritance
• Polymorphism
• Abstraction
Modelling our Game as OOP

More Related Content

What's hot (20)

Design principles - SOLID
Design principles - SOLIDDesign principles - SOLID
Design principles - SOLID
Pranalee Rokde
 
Clean code
Clean codeClean code
Clean code
Henrique Smoco
 
Applets in java
Applets in javaApplets in java
Applets in java
Wani Zahoor
 
Class and Objects in Java
Class and Objects in JavaClass and Objects in Java
Class and Objects in Java
Spotle.ai
 
Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...
Mr. Akaash
 
Solid principles
Solid principlesSolid principles
Solid principles
Toan Nguyen
 
Multiple inheritance in c++
Multiple inheritance in c++Multiple inheritance in c++
Multiple inheritance in c++
Sujan Mia
 
DBMS Notes: DDL DML DCL
DBMS Notes: DDL DML DCLDBMS Notes: DDL DML DCL
DBMS Notes: DDL DML DCL
Sreedhar Chowdam
 
Java package
Java packageJava package
Java package
CS_GDRCST
 
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
Simplilearn
 
Method overloading
Method overloadingMethod overloading
Method overloading
Lovely Professional University
 
This keyword in java
This keyword in javaThis keyword in java
This keyword in java
Hitesh Kumar
 
Abstract class in java
Abstract class in javaAbstract class in java
Abstract class in java
Lovely Professional University
 
Java I/O
Java I/OJava I/O
Java I/O
Jussi Pohjolainen
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methods
Shubham Dwivedi
 
Inheritance in OOPS
Inheritance in OOPSInheritance in OOPS
Inheritance in OOPS
Ronak Chhajed
 
Procedure and Functions in pl/sql
Procedure and Functions in pl/sqlProcedure and Functions in pl/sql
Procedure and Functions in pl/sql
Ñirmal Tatiwal
 
Design patterns tutorials
Design patterns tutorialsDesign patterns tutorials
Design patterns tutorials
University of Technology
 
Introduction to method overloading &amp; method overriding in java hdm
Introduction to method overloading &amp; method overriding  in java  hdmIntroduction to method overloading &amp; method overriding  in java  hdm
Introduction to method overloading &amp; method overriding in java hdm
Harshal Misalkar
 
Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)
Ritika Sharma
 
Design principles - SOLID
Design principles - SOLIDDesign principles - SOLID
Design principles - SOLID
Pranalee Rokde
 
Class and Objects in Java
Class and Objects in JavaClass and Objects in Java
Class and Objects in Java
Spotle.ai
 
Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...
Mr. Akaash
 
Solid principles
Solid principlesSolid principles
Solid principles
Toan Nguyen
 
Multiple inheritance in c++
Multiple inheritance in c++Multiple inheritance in c++
Multiple inheritance in c++
Sujan Mia
 
Java package
Java packageJava package
Java package
CS_GDRCST
 
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
Simplilearn
 
This keyword in java
This keyword in javaThis keyword in java
This keyword in java
Hitesh Kumar
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methods
Shubham Dwivedi
 
Procedure and Functions in pl/sql
Procedure and Functions in pl/sqlProcedure and Functions in pl/sql
Procedure and Functions in pl/sql
Ñirmal Tatiwal
 
Introduction to method overloading &amp; method overriding in java hdm
Introduction to method overloading &amp; method overriding  in java  hdmIntroduction to method overloading &amp; method overriding  in java  hdm
Introduction to method overloading &amp; method overriding in java hdm
Harshal Misalkar
 
Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)
Ritika Sharma
 

Similar to Object Oriented Programming (OOP) Introduction (20)

SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPT
Skillwise Group
 
Oops concepts
Oops conceptsOops concepts
Oops concepts
ACCESS Health Digital
 
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPUUNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
ApurvaLaddha
 
object oriented programing lecture 1
object oriented programing lecture 1object oriented programing lecture 1
object oriented programing lecture 1
Geophery sanga
 
JAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptxJAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptx
KunalYadav65140
 
JAVA-PPT'S.pptx
JAVA-PPT'S.pptxJAVA-PPT'S.pptx
JAVA-PPT'S.pptx
RaazIndia
 
Oop concepts classes_objects
Oop concepts classes_objectsOop concepts classes_objects
Oop concepts classes_objects
William Olivier
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
DurgaPrasadVasantati
 
OOP Presentation.pptx
OOP Presentation.pptxOOP Presentation.pptx
OOP Presentation.pptx
DurgaPrasadVasantati
 
Cble assignment powerpoint activity for moodle 1
Cble assignment powerpoint activity for moodle 1Cble assignment powerpoint activity for moodle 1
Cble assignment powerpoint activity for moodle 1
LK394
 
L1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdfL1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
General oop concept
General oop conceptGeneral oop concept
General oop concept
Avneesh Yadav
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Saiful Islam Sany
 
Question and answer Programming
Question and answer ProgrammingQuestion and answer Programming
Question and answer Programming
Inocentshuja Ahmad
 
An overview of Object Oriented Programming in C#.
An overview of Object Oriented Programming in C#.An overview of Object Oriented Programming in C#.
An overview of Object Oriented Programming in C#.
prajapatrishabh421
 
Oops
OopsOops
Oops
Sankar Balasubramanian
 
Ooad notes
Ooad notesOoad notes
Ooad notes
NancyJP
 
Object-Oriented concepts.pptx
Object-Oriented concepts.pptxObject-Oriented concepts.pptx
Object-Oriented concepts.pptx
BHARATH KUMAR
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
Abhigyan Singh Yadav
 
Object
ObjectObject
Object
Mohammad Mahdi Rahimi Moghadam
 
SKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPTSKILLWISE - OOPS CONCEPT
SKILLWISE - OOPS CONCEPT
Skillwise Group
 
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPUUNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
ApurvaLaddha
 
object oriented programing lecture 1
object oriented programing lecture 1object oriented programing lecture 1
object oriented programing lecture 1
Geophery sanga
 
JAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptxJAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptx
KunalYadav65140
 
JAVA-PPT'S.pptx
JAVA-PPT'S.pptxJAVA-PPT'S.pptx
JAVA-PPT'S.pptx
RaazIndia
 
Oop concepts classes_objects
Oop concepts classes_objectsOop concepts classes_objects
Oop concepts classes_objects
William Olivier
 
Cble assignment powerpoint activity for moodle 1
Cble assignment powerpoint activity for moodle 1Cble assignment powerpoint activity for moodle 1
Cble assignment powerpoint activity for moodle 1
LK394
 
L1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdfL1-Introduction to OOPs concepts.pdf
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
Question and answer Programming
Question and answer ProgrammingQuestion and answer Programming
Question and answer Programming
Inocentshuja Ahmad
 
An overview of Object Oriented Programming in C#.
An overview of Object Oriented Programming in C#.An overview of Object Oriented Programming in C#.
An overview of Object Oriented Programming in C#.
prajapatrishabh421
 
Ooad notes
Ooad notesOoad notes
Ooad notes
NancyJP
 
Object-Oriented concepts.pptx
Object-Oriented concepts.pptxObject-Oriented concepts.pptx
Object-Oriented concepts.pptx
BHARATH KUMAR
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
Abhigyan Singh Yadav
 
Ad

Recently uploaded (20)

“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME FlowProviding an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Introduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUEIntroduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUE
Google Developer Group On Campus European Universities in Egypt
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data ResilienceFloods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Ben Blair - Operating Safely in a Vibe Coding World
Ben Blair - Operating Safely in a Vibe Coding WorldBen Blair - Operating Safely in a Vibe Coding World
Ben Blair - Operating Safely in a Vibe Coding World
AWS Chicago
 
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Impelsys Inc.
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationAI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
Christine Shepherd
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI FoundationsOracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free DownloadViral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdfEdge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
Providing an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME FlowProviding an OGC API Processes REST Interface for FME Flow
Providing an OGC API Processes REST Interface for FME Flow
Safe Software
 
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data ResilienceFloods in Valencia: Two FME-Powered Stories of Data Resilience
Floods in Valencia: Two FME-Powered Stories of Data Resilience
Safe Software
 
Ben Blair - Operating Safely in a Vibe Coding World
Ben Blair - Operating Safely in a Vibe Coding WorldBen Blair - Operating Safely in a Vibe Coding World
Ben Blair - Operating Safely in a Vibe Coding World
AWS Chicago
 
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...
Impelsys Inc.
 
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfBoosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdf
Alkin Tezuysal
 
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025Developing Schemas with FME and Excel - Peak of Data & AI 2025
Developing Schemas with FME and Excel - Peak of Data & AI 2025
Safe Software
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...Bridging the divide: A conversation on tariffs today in the book industry - T...
Bridging the divide: A conversation on tariffs today in the book industry - T...
BookNet Canada
 
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationAI Agents in Logistics and Supply Chain Applications Benefits and Implementation
AI Agents in Logistics and Supply Chain Applications Benefits and Implementation
Christine Shepherd
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI FoundationsOracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free DownloadViral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Viral>Wondershare Filmora 14.5.18.12900 Crack Free Download
Puppy jhon
 
Edge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdfEdge-banding-machines-edgeteq-s-200-en-.pdf
Edge-banding-machines-edgeteq-s-200-en-.pdf
AmirStern2
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...
Anish Kumar
 
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely Demo Showcase: Powering ServiceNow Discovery with Precisely Ironstr...
Precisely
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdfCrypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Ad

Object Oriented Programming (OOP) Introduction

  • 2. Pre-Requisites • Familiarity with functions and types • Basic understanding of a class • Has an overall Introduction to programming • We will be using C# for code samples
  • 3. Pre-Requisite Check 1. Write a simple function to add all numbers in the array below int [] array = new int[] {2,4,5,6,7,8,8,9,0,10,5,7} Hint <visibility> <return type> <name>(<parameters>) { <function code> } You can logon Here -> C# Online Compiler | .NET Fiddle (dotnetfiddle.net) and complete your code.
  • 4. Answer and Modification 1. Overload the function to take 3 numbers 2. Overload the method to take any amount of numbers 3. Change the function into a lambda format
  • 5. Structure Procedural Oriented Programming Overview Limitations of POP Object Oriented Programming Overview • Encapsulation • Inheritance • Polymorphism • Abstraction Core Components • Access Modifiers • Static Class and Methods Key Terms
  • 6. Procedural Oriented Programming • C , Pascal, FORTRAN, and similar languages are procedural languages • Each Statement in the language tells the computer to do something • Get some Input • Add these numbers • Divide by 4 • Display the number A program in a procedural language is a list of instructions
  • 7. Divided Into Functions • Procedural program is divided into functions • Each function has clearly defined purpose and how it interfaces with other functions in the program • One can also further extend functions by grouping several functions together into a larger entity called Modules .
  • 8. Divided Into Functions • In Multi-Function program important data items are placed as Global so that they maybe accessed by all functions • Each function may also have its own local data
  • 9. Limitations for POP • Since all functions have accessed to the Global Variable , new functions accidentally created can corrupt the data • We can access the data of one function from other since there is no protection • In a large program it is difficult to trace what data is used by which function • If new data is added , all the functions are to be modified to access this data
  • 10. Object Oriented Programming • OOP was introduced to overcome flaws in the procedural approach to programming • Such as lack of Reusability and Maintainability • The Fundamental idea behind OOP is to combine into a single unit both data and functions that operate on them. • Such a unit is called an Object .
  • 11. Objects? In the real world, just about anything can be seen as an object: car, dog, person, department, city, etc. These have state and behavior. For example, a dog's state is its color, breed and name; its behavior is the way it barks, runs or wags its tail. Objects in OOP are quite similar
  • 12. Example Identify the Properties (State) and Behavior (Methods) of Your Bicycle
  • 14. Object Oriented Programming • In OOP, problem is divided into number of entities called objects and then builds data and functions around these objects • It ties the data more closely to the functions that operate it and protects it from accidental modification from the outside functions • Data of an object can only be accessed by the functions associated with that object • Communication of the objects done through functions.
  • 15. Classes • Classes are user-defined data types • Objects are variables of a class • Once a class has been defined, we can create any number of objects from the Class • A class thus can be said as a collection of similar objects of same type.
  • 16. Example • Let us consider a software that involves renting cars. • We can have a class and objects as below
  • 17. Example Let us consider a software that involves a zoo. What are some of the classes and objects to be created .
  • 20. Encapsulation • Encapsulation is the first pillar or principle of object-oriented programming • In simple words, “Encapsulation is a process of binding data members (variables, properties) and member functions(methods) into a single unit” • And a Class is the best example of encapsulation • Data Hiding from all external Classes
  • 22. Encapsulation in Real Life •Has prescription •Does not have direct contact to the medicines Patient •Has Access to the medicine •Returns the right medicine •Reduces risk of you getting wrong medicine Chemist •Can only be accessed by chemists •Several medicines available for different treatments Medicines
  • 23. Encapsulation in OOP •Has no direct access to data in the medicine class External Classes •Controls access and manipulation of data in the medicine class •They are wrapped in the class Functions •Medicine Class •Contains both member functions and Variables •Determines how accessible the data is to outside world Medicines
  • 24. Encapsulation in OOP So, Encapsulation means hiding the important features of a class which has no usefulness being exposed to outside of the class and exposing only the necessary things of the class.
  • 25. Abstraction Abstraction is about describing something at a conceptual level while leaving out the details. example, we may talk about a vehicle without being explicit if it's a ship or a car.
  • 26. Example of Abstraction When using the tv remote control, you do not bother about how pressing a key in the remote changes the channel on the TV. You Just know that pressing the “+” volume button will increase the volume.
  • 27. Example of Abstraction • A class can be abstract as well meaning , it can provide you functions without their implementation • For example, if our class was a remote control , it will give us the method IncreaseVolume() without details of how It will be done . Such a method is called an abstract method
  • 28. Example of Abstraction • You cannot instantiate this class Animal myObj = new Animal(); // Will generate an error • You can only Inherit this class
  • 29. Inheritance • The mechanism of deriving a new class from an old class is called inheritance or derivation • The Old class is known as base class while new class is known as derived class or sub class • Inheritance is the most powerful feature of OOP. • Gives the sub class access to methods of based class
  • 30. Example If a child is as Tall as his dad and Fair as his mom , we usually say the child has inherited these features from his father and mother.
  • 31. Example using System; namespace MyApplication { class Vehicle // Base class { public string brand = "Ford"; // Vehicle field public void honk() // Vehicle method { Console.WriteLine("Tuut, tuut!"); } } } • The Base class here is Vehicle • It has Properties (Brand) and an implemented Method honk
  • 32. Example using System; namespace MyApplication { class Car : Vehicle // Derived class { public string modelName = "Mustang"; // Car field } } • The Base class here is Vehicle • The Car class is inheriting the vehicle class and thus Will have access to the honk method in the Vehicle class. • Inheritance is shown by the “:” sign . Colon.
  • 33. Example Code Snippet using System; namespace MyApplication { class Program { static void Main(string[] args) { // Create a myCar object Car myCar = new Car(); // Call the honk() method (From the Vehicle class) on the myCar object myCar.honk(); // Display the value of the brand field (from the Vehicle class) and the value of the modelName from the Car class Console.WriteLine(myCar.brand + " " + myCar.modelName); } } }
  • 34. Inheritance • Through Effective use of inheritance , you can save a lot of time in your programming and reduces errors • This will also increase the quality of the work and productivity
  • 35. Polymorphism • Polymorphism means "many forms", and it occurs when we have many classes that are related to each other by inheritance • Inheritance lets us inherit fields and methods from another class. Polymorphism uses those methods to perform different tasks. This allows us to perform a single action in different ways.
  • 36. Example For example, think of a base class called Animal that has a method called animalSound(). Derived classes of Animals could be Pigs, Cats, Dogs, Birds - And they also have their own implementation of an animal sound (the pig oinks, and the cat meows, etc.):
  • 37. Example class Animal // Base class (parent) { public void animalSound() { Console.WriteLine("The animal makes a sound"); } } class Pig : Animal // Derived class (child) { public void animalSound() { Console.WriteLine("The pig says: wee wee"); } }
  • 38. Next Lecture Object Oriented Programming Implementation Building a Game with C# Unity 3D and C# • Encapsulation • Inheritance • Polymorphism • Abstraction Modelling our Game as OOP