SlideShare a Scribd company logo
Introduction to oop
What is OOP?
• OOP is a design philosophy. It stands for Object Oriented
Programming. Object-Oriented Programming (OOP) uses a different
set of programming languages than old procedural programming
languages (C, Pascal, etc.). Everything in OOP is grouped as self
sustainable "objects". Hence, you gain reusability by means of four
main object-oriented programming concepts.
• In order to clearly understand the object orientation model, let’s
take your “hand” as an example. The “hand” is a class. Your body
has two objects of the type "hand", named "left hand" and "right
hand". Their main functions are controlled or managed by a set of
electrical signals sent through your shoulders (through an
interface). So the shoulder is an interface that your body uses to
interact with your hands. The hand is a well-architected class. The
hand is being reused to create the left hand and the right hand by
slightly changing the properties of it.
What is an Object?
• An object can be considered a "thing" that can
perform a set of related activities. The set of
activities that the object performs defines the
object's behavior. For example,
the Hand (object) can grip something, or
a Student(object) can give their name or
address.
• In pure OOP terms an object is an instance of
a class.
What is a Class?
• A class is simply a representation of a type of object. It is
the blueprint, or plan, or template, that describes the
details of an object. A class is the blueprint from which the
individual objects are created. Class is composed of three
things: a name, attributes, and operations.
• public class Student {
}
• According to the sample given below we can say that
the Student object, named objectStudent, has been
created out of the Student class.
• Student objectStudent = new Student();
classes
• In order to manage the classes of a software
system, and to reduce the complexity, system
designers use several techniques, which can
be grouped under four main concepts named
• 1. Encapsulation
• 2. Abstraction
• 3. Inheritance
• 4. Polymorphism.
What is Encapsulation (or Information
Hiding)?
• The encapsulation is the inclusion-within a program object-of
all the resources needed for the object to function, basically,
the methods and the data.
• In OOP the encapsulation is mainly achieved by creating
classes, the classes expose public methods and properties.
• A class is kind of a container or capsule or a cell, which
encapsulate a set of methods, attribute and properties to
provide its indented functionalities to other classes. In that
sense, encapsulation also allows a class to change its internal
implementation without hurting the overall functioning of the
system.
• That idea of encapsulation is to hide how a class does its
business, while allowing other classes to make requests of it.
What is Abstraction
• Abstraction is an emphasis on the idea, qualities and
properties rather than the particulars (a suppression of
detail). The importance of abstraction is derived from
its ability to hide irrelevant details and from the use of
names to reference objects.
• Abstraction is essential in the construction of
programs. It places the emphasis on what an object is
or does rather than how it is represented or how it
works. Thus, it is the primary means of managing
complexity in large programs.
• While abstraction reduces complexity by hiding
irrelevant detail
What is an Abstract class?
• Abstract classes, which declared with the abstract keyword,
cannot be instantiated. It can only be used as a super-class
for other classes that extend the abstract class.
• Abstract class is the concept and implementation gets
completed when it is being realized by a subclass. In
addition to this a class can inherit only from one abstract
class (but a class may implement many interfaces) and and
must override all its methods/properties that are declared
to be abstract and may override virtual methods/
properties.
• Abstract classes are ideal when implementing frameworks.
What is an Interface?
• Interface can be used to define a generic template and then one or
more abstract classes to define partial implementations of the
interface. Interfaces just specify the method declaration (implicitly
public and abstract) and can contain properties (which are also
implicitly public and abstract).
• Interface definition begins with the keyword interface. An interface
like that of an abstract class cannot be instantiated.
• If a class that implements an interface does not define all the
methods of the interface, then it must be declared abstract and the
method definitions must be provided by the subclass that extends
the abstract class. In addition to this an interfaces can inherit other
interfaces.
• public interface ILogger {
• bool IsThisLogError { get; } }
What is Polymorphism?
• Polymorphisms is a generic term that means
'many shapes'. More
precisely Polymorphisms means the ability to
request that the same operations be performed
by a wide range of different types of things.
• In OOP the polymorphisms is achieved by using
many different techniques named method
overloading, operator overloading, and method
overriding,
What is Method Overloading?
• Method overloading is the ability to define several methods all with the
same name.
• public class MyLogger
{
public void LogError(Exception e)
{
// Implementation goes here
}
public bool LogError(Exception e, string message)
{
// Implementation goes here
}
}
What is Method Overriding?
• Method overriding is a language feature that
allows a subclass to override a specific
implementation of a method that is already
provided by one of its super-classes.
• A subclass can give its own definition of methods
but need to have the same signature and same
name as the method in its super-class. This
means that when overriding a method the
subclass's method has to have the same name
and parameter list as the super-class' overridden
method.
example
• using System;
public class Complex
{
private int real;
public int Real
{ get { return real; } }
private int imaginary;
public int Imaginary
{ get { return imaginary; } }
public Complex(int real, int imaginary)
{
this.real = real;
this.imaginary = imaginary;
}
public static Complex operator +(Complex c1, Complex c2)
{
return new Complex(c1.Real + c2.Real, c1.Imaginary + c2.Imaginary);
}
public override string ToString()
{
return (String.Format("{0} + {1}i", real, imaginary));
}}
Access modifiers
• public
• The type or member can be accessed by any other
code in the same class or another class that references
it.
• private
• The type or member can only be accessed by code in
the same class or struct.
• protected
• The type or member can only be accessed by code in
the same class or struct, or in a derived class.
Access modifier
• Static
• The static modifier on a class means that the class
cannot be instantiated, and that all of its members are
static. A static member has one version regardless of
how many instances of its enclosing type are created.
• A static class is basically the same as a non-static class,
but there is one difference: a static class cannot be
externally instantiated. In other words, you cannot use
the new keyword to create a variable of the class type.
Because there is no instance variable, you access the
members of a static class by using the class name itself.

More Related Content

What's hot

C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
Boopathi K
 
Ch.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objectsCh.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objects
ITNet
 
Object Oriented Programming ppt presentation
Object Oriented Programming ppt presentationObject Oriented Programming ppt presentation
Object Oriented Programming ppt presentation
AyanaRukasar
 
Concepts In Object Oriented Programming Languages
Concepts In Object Oriented Programming LanguagesConcepts In Object Oriented Programming Languages
Concepts In Object Oriented Programming Languages
ppd1961
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
RahulAnanda1
 
Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)
MD Sulaiman
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
Sujith Kumar
 
Polymorphism in c++(ppt)
Polymorphism in c++(ppt)Polymorphism in c++(ppt)
Polymorphism in c++(ppt)
Sanjit Shaw
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
Ravi Kant Sahu
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming language
Md.Al-imran Roton
 
Polymorphism presentation in java
Polymorphism presentation in javaPolymorphism presentation in java
Polymorphism presentation in java
Ahsan Raja
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
Nilesh Dalvi
 
Introduction to Java -unit-1
Introduction to Java -unit-1Introduction to Java -unit-1
Introduction to Java -unit-1
RubaNagarajan
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
Muhammad Waqas
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methods
Shubham Dwivedi
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
Paumil Patel
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++
HalaiHansaika
 

What's hot (20)

C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
 
Ch.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objectsCh.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objects
 
Object Oriented Programming ppt presentation
Object Oriented Programming ppt presentationObject Oriented Programming ppt presentation
Object Oriented Programming ppt presentation
 
Concepts In Object Oriented Programming Languages
Concepts In Object Oriented Programming LanguagesConcepts In Object Oriented Programming Languages
Concepts In Object Oriented Programming Languages
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)
 
OOP java
OOP javaOOP java
OOP java
 
Oops ppt
Oops pptOops ppt
Oops ppt
 
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in PythonBasics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
 
Arrays in Java
Arrays in JavaArrays in Java
Arrays in Java
 
Polymorphism in c++(ppt)
Polymorphism in c++(ppt)Polymorphism in c++(ppt)
Polymorphism in c++(ppt)
 
Introduction to Java Programming
Introduction to Java ProgrammingIntroduction to Java Programming
Introduction to Java Programming
 
OOP Introduction with java programming language
OOP Introduction with java programming languageOOP Introduction with java programming language
OOP Introduction with java programming language
 
Polymorphism presentation in java
Polymorphism presentation in javaPolymorphism presentation in java
Polymorphism presentation in java
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
 
Introduction to Java -unit-1
Introduction to Java -unit-1Introduction to Java -unit-1
Introduction to Java -unit-1
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methods
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++
 

Similar to Introduction to oop

oop.pptx
oop.pptxoop.pptx
oop.pptx
KabitaParajuli3
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
MH Abid
 
object oriented programing lecture 1
object oriented programing lecture 1object oriented programing lecture 1
object oriented programing lecture 1
Geophery sanga
 
Object oriented programming
Object oriented programmingObject oriented programming
Pi j3.2 polymorphism
Pi j3.2 polymorphismPi j3.2 polymorphism
Pi j3.2 polymorphism
mcollison
 
Object Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) IntroductionObject Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) Introduction
SamuelAnsong6
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Saiful Islam Sany
 
JAVA-PPT'S.pdf
JAVA-PPT'S.pdfJAVA-PPT'S.pdf
JAVA-PPT'S.pdf
AnmolVerma363503
 
Lesson 13 object and class
Lesson 13 object and classLesson 13 object and class
Lesson 13 object and class
MLG College of Learning, Inc
 
Php oop (1)
Php oop (1)Php oop (1)
Php oop (1)
Sudip Simkhada
 
C++ first s lide
C++ first s lideC++ first s lide
C++ first s lide
Sudhriti Gupta
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2Rakesh Madugula
 
OOPS – General Understanding in .NET
OOPS – General Understanding in .NETOOPS – General Understanding in .NET
OOPS – General Understanding in .NET
Sabith Byari
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
Ahmed Farag
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answer
Jeba Moses
 
Abstraction in java [abstract classes and Interfaces
Abstraction in java [abstract classes and InterfacesAbstraction in java [abstract classes and Interfaces
Abstraction in java [abstract classes and Interfaces
Ahmed Nobi
 
Fundamentals of oops in .Net
Fundamentals of oops in .NetFundamentals of oops in .Net
Fundamentals of oops in .Net
Harman Bajwa
 
Lecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxLecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptx
ShaownRoy1
 
Oopsinphp
OopsinphpOopsinphp
Oopsinphp
NithyaNithyav
 

Similar to Introduction to oop (20)

oop.pptx
oop.pptxoop.pptx
oop.pptx
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
object oriented programing lecture 1
object oriented programing lecture 1object oriented programing lecture 1
object oriented programing lecture 1
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Pi j3.2 polymorphism
Pi j3.2 polymorphismPi j3.2 polymorphism
Pi j3.2 polymorphism
 
Object Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) IntroductionObject Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) Introduction
 
My c++
My c++My c++
My c++
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
JAVA-PPT'S.pdf
JAVA-PPT'S.pdfJAVA-PPT'S.pdf
JAVA-PPT'S.pdf
 
Lesson 13 object and class
Lesson 13 object and classLesson 13 object and class
Lesson 13 object and class
 
Php oop (1)
Php oop (1)Php oop (1)
Php oop (1)
 
C++ first s lide
C++ first s lideC++ first s lide
C++ first s lide
 
Md02 - Getting Started part-2
Md02 - Getting Started part-2Md02 - Getting Started part-2
Md02 - Getting Started part-2
 
OOPS – General Understanding in .NET
OOPS – General Understanding in .NETOOPS – General Understanding in .NET
OOPS – General Understanding in .NET
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
 
EEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answerEEE oops Vth semester viva questions with answer
EEE oops Vth semester viva questions with answer
 
Abstraction in java [abstract classes and Interfaces
Abstraction in java [abstract classes and InterfacesAbstraction in java [abstract classes and Interfaces
Abstraction in java [abstract classes and Interfaces
 
Fundamentals of oops in .Net
Fundamentals of oops in .NetFundamentals of oops in .Net
Fundamentals of oops in .Net
 
Lecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxLecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptx
 
Oopsinphp
OopsinphpOopsinphp
Oopsinphp
 

More from colleges

introduction to machine learning
introduction to machine learningintroduction to machine learning
introduction to machine learning
colleges
 
searching
searchingsearching
searching
colleges
 
searching technique
searching techniquesearching technique
searching technique
colleges
 
Automata theory
Automata theoryAutomata theory
Automata theory
colleges
 
Introduction to web architecture
Introduction to web architectureIntroduction to web architecture
Introduction to web architecture
colleges
 
Enterprise application development
Enterprise application developmentEnterprise application development
Enterprise application development
colleges
 

More from colleges (6)

introduction to machine learning
introduction to machine learningintroduction to machine learning
introduction to machine learning
 
searching
searchingsearching
searching
 
searching technique
searching techniquesearching technique
searching technique
 
Automata theory
Automata theoryAutomata theory
Automata theory
 
Introduction to web architecture
Introduction to web architectureIntroduction to web architecture
Introduction to web architecture
 
Enterprise application development
Enterprise application developmentEnterprise application development
Enterprise application development
 

Recently uploaded

Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
NaapbooksPrivateLimi
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
Jelle | Nordend
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
MayankTawar1
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
KrzysztofKkol1
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Hivelance Technology
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 

Recently uploaded (20)

Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Visitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.appVisitor Management System in India- Vizman.app
Visitor Management System in India- Vizman.app
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
Multiple Your Crypto Portfolio with the Innovative Features of Advanced Crypt...
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 

Introduction to oop

  • 2. What is OOP? • OOP is a design philosophy. It stands for Object Oriented Programming. Object-Oriented Programming (OOP) uses a different set of programming languages than old procedural programming languages (C, Pascal, etc.). Everything in OOP is grouped as self sustainable "objects". Hence, you gain reusability by means of four main object-oriented programming concepts. • In order to clearly understand the object orientation model, let’s take your “hand” as an example. The “hand” is a class. Your body has two objects of the type "hand", named "left hand" and "right hand". Their main functions are controlled or managed by a set of electrical signals sent through your shoulders (through an interface). So the shoulder is an interface that your body uses to interact with your hands. The hand is a well-architected class. The hand is being reused to create the left hand and the right hand by slightly changing the properties of it.
  • 3. What is an Object? • An object can be considered a "thing" that can perform a set of related activities. The set of activities that the object performs defines the object's behavior. For example, the Hand (object) can grip something, or a Student(object) can give their name or address. • In pure OOP terms an object is an instance of a class.
  • 4. What is a Class? • A class is simply a representation of a type of object. It is the blueprint, or plan, or template, that describes the details of an object. A class is the blueprint from which the individual objects are created. Class is composed of three things: a name, attributes, and operations. • public class Student { } • According to the sample given below we can say that the Student object, named objectStudent, has been created out of the Student class. • Student objectStudent = new Student();
  • 5.
  • 6. classes • In order to manage the classes of a software system, and to reduce the complexity, system designers use several techniques, which can be grouped under four main concepts named • 1. Encapsulation • 2. Abstraction • 3. Inheritance • 4. Polymorphism.
  • 7. What is Encapsulation (or Information Hiding)? • The encapsulation is the inclusion-within a program object-of all the resources needed for the object to function, basically, the methods and the data. • In OOP the encapsulation is mainly achieved by creating classes, the classes expose public methods and properties. • A class is kind of a container or capsule or a cell, which encapsulate a set of methods, attribute and properties to provide its indented functionalities to other classes. In that sense, encapsulation also allows a class to change its internal implementation without hurting the overall functioning of the system. • That idea of encapsulation is to hide how a class does its business, while allowing other classes to make requests of it.
  • 8. What is Abstraction • Abstraction is an emphasis on the idea, qualities and properties rather than the particulars (a suppression of detail). The importance of abstraction is derived from its ability to hide irrelevant details and from the use of names to reference objects. • Abstraction is essential in the construction of programs. It places the emphasis on what an object is or does rather than how it is represented or how it works. Thus, it is the primary means of managing complexity in large programs. • While abstraction reduces complexity by hiding irrelevant detail
  • 9. What is an Abstract class? • Abstract classes, which declared with the abstract keyword, cannot be instantiated. It can only be used as a super-class for other classes that extend the abstract class. • Abstract class is the concept and implementation gets completed when it is being realized by a subclass. In addition to this a class can inherit only from one abstract class (but a class may implement many interfaces) and and must override all its methods/properties that are declared to be abstract and may override virtual methods/ properties. • Abstract classes are ideal when implementing frameworks.
  • 10. What is an Interface? • Interface can be used to define a generic template and then one or more abstract classes to define partial implementations of the interface. Interfaces just specify the method declaration (implicitly public and abstract) and can contain properties (which are also implicitly public and abstract). • Interface definition begins with the keyword interface. An interface like that of an abstract class cannot be instantiated. • If a class that implements an interface does not define all the methods of the interface, then it must be declared abstract and the method definitions must be provided by the subclass that extends the abstract class. In addition to this an interfaces can inherit other interfaces. • public interface ILogger { • bool IsThisLogError { get; } }
  • 11. What is Polymorphism? • Polymorphisms is a generic term that means 'many shapes'. More precisely Polymorphisms means the ability to request that the same operations be performed by a wide range of different types of things. • In OOP the polymorphisms is achieved by using many different techniques named method overloading, operator overloading, and method overriding,
  • 12. What is Method Overloading? • Method overloading is the ability to define several methods all with the same name. • public class MyLogger { public void LogError(Exception e) { // Implementation goes here } public bool LogError(Exception e, string message) { // Implementation goes here } }
  • 13. What is Method Overriding? • Method overriding is a language feature that allows a subclass to override a specific implementation of a method that is already provided by one of its super-classes. • A subclass can give its own definition of methods but need to have the same signature and same name as the method in its super-class. This means that when overriding a method the subclass's method has to have the same name and parameter list as the super-class' overridden method.
  • 14. example • using System; public class Complex { private int real; public int Real { get { return real; } } private int imaginary; public int Imaginary { get { return imaginary; } } public Complex(int real, int imaginary) { this.real = real; this.imaginary = imaginary; } public static Complex operator +(Complex c1, Complex c2) { return new Complex(c1.Real + c2.Real, c1.Imaginary + c2.Imaginary); } public override string ToString() { return (String.Format("{0} + {1}i", real, imaginary)); }}
  • 15. Access modifiers • public • The type or member can be accessed by any other code in the same class or another class that references it. • private • The type or member can only be accessed by code in the same class or struct. • protected • The type or member can only be accessed by code in the same class or struct, or in a derived class.
  • 16. Access modifier • Static • The static modifier on a class means that the class cannot be instantiated, and that all of its members are static. A static member has one version regardless of how many instances of its enclosing type are created. • A static class is basically the same as a non-static class, but there is one difference: a static class cannot be externally instantiated. In other words, you cannot use the new keyword to create a variable of the class type. Because there is no instance variable, you access the members of a static class by using the class name itself.