SlideShare a Scribd company logo
4
Most read
9
Most read
15
Most read
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();
Introduction to oop
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 (20)

ODP
OOP java
xball977
 
PPT
Object Oriented Programming Concepts
thinkphp
 
PPTX
Delegates and events in C#
Dr.Neeraj Kumar Pandey
 
PPTX
1 unit (oops)
Jay Patel
 
PPTX
Constructor overloading & method overloading
garishma bhatia
 
PPT
Oops in Java
malathip12
 
PPTX
Oops concept in c++ unit 3 -topic 4
MOHIT TOMAR
 
PPTX
Method overloading
Lovely Professional University
 
PPTX
Data types in java
HarshitaAshwani
 
PDF
Class and Objects in Java
Spotle.ai
 
PDF
Files in java
Muthukumaran Subramanian
 
PPTX
This keyword in java
Hitesh Kumar
 
PPTX
Pure virtual function and abstract class
Amit Trivedi
 
PPTX
Polymorphism in c++(ppt)
Sanjit Shaw
 
PPTX
Object Oriented Programming Concepts for beginners
Vibhawa Nirmal
 
PPT
Object Oriented Programming Concepts using Java
Glenn Guden
 
PPTX
Object oriented programming
Amit Soni (CTFL)
 
PPT
Object-oriented concepts
BG Java EE Course
 
PDF
Python - object oriented
Learnbay Datascience
 
PPSX
Introduction to java
Ajay Sharma
 
OOP java
xball977
 
Object Oriented Programming Concepts
thinkphp
 
Delegates and events in C#
Dr.Neeraj Kumar Pandey
 
1 unit (oops)
Jay Patel
 
Constructor overloading & method overloading
garishma bhatia
 
Oops in Java
malathip12
 
Oops concept in c++ unit 3 -topic 4
MOHIT TOMAR
 
Method overloading
Lovely Professional University
 
Data types in java
HarshitaAshwani
 
Class and Objects in Java
Spotle.ai
 
This keyword in java
Hitesh Kumar
 
Pure virtual function and abstract class
Amit Trivedi
 
Polymorphism in c++(ppt)
Sanjit Shaw
 
Object Oriented Programming Concepts for beginners
Vibhawa Nirmal
 
Object Oriented Programming Concepts using Java
Glenn Guden
 
Object oriented programming
Amit Soni (CTFL)
 
Object-oriented concepts
BG Java EE Course
 
Python - object oriented
Learnbay Datascience
 
Introduction to java
Ajay Sharma
 

Similar to Introduction to oop (20)

PPTX
OOP Presentation.pptx
DurgaPrasadVasantati
 
PPTX
OOP Presentation.pptx
DurgaPrasadVasantati
 
PPTX
Fundamentals of oops in .Net
Harman Bajwa
 
PPTX
Concepts of oops
Sourabrata Mukherjee
 
PPTX
OOPS – General Understanding in .NET
Sabith Byari
 
PPTX
Better Understanding OOP using C#
Chandan Gupta Bhagat
 
PPTX
Object Oriented Principles
Emprovise
 
PPTX
OOP-Advanced Programming with c++
Mohamed Essam
 
PPTX
SKILLWISE - OOPS CONCEPT
Skillwise Group
 
PDF
Object oriented programming
mustafa sarac
 
PDF
Object-oriented Analysis, Design & Programming
Allan Mangune
 
PDF
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
PPTX
Object oriented programming
MH Abid
 
PPT
Opps
Lalit Kale
 
PPTX
Object oriented programming
Saiful Islam Sany
 
PDF
Object-Oriented Programming in Java (Module 1)
muhammadmubinmacadad2
 
PDF
OOPs difference faqs-3
Umar Ali
 
OOP Presentation.pptx
DurgaPrasadVasantati
 
OOP Presentation.pptx
DurgaPrasadVasantati
 
Fundamentals of oops in .Net
Harman Bajwa
 
Concepts of oops
Sourabrata Mukherjee
 
OOPS – General Understanding in .NET
Sabith Byari
 
Better Understanding OOP using C#
Chandan Gupta Bhagat
 
Object Oriented Principles
Emprovise
 
OOP-Advanced Programming with c++
Mohamed Essam
 
SKILLWISE - OOPS CONCEPT
Skillwise Group
 
Object oriented programming
mustafa sarac
 
Object-oriented Analysis, Design & Programming
Allan Mangune
 
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
Object oriented programming
MH Abid
 
Object oriented programming
Saiful Islam Sany
 
Object-Oriented Programming in Java (Module 1)
muhammadmubinmacadad2
 
OOPs difference faqs-3
Umar Ali
 
Ad

More from colleges (6)

DOCX
introduction to machine learning
colleges
 
DOCX
searching
colleges
 
DOCX
searching technique
colleges
 
DOCX
Automata theory
colleges
 
PPTX
Introduction to web architecture
colleges
 
PPTX
Enterprise application development
colleges
 
introduction to machine learning
colleges
 
searching
colleges
 
searching technique
colleges
 
Automata theory
colleges
 
Introduction to web architecture
colleges
 
Enterprise application development
colleges
 
Ad

Recently uploaded (20)

PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PPTX
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PDF
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PPTX
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Technical-Careers-Roadmap-in-Software-Market.pdf
Hussein Ali
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
ChiSquare Procedure in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
Wondershare PDFelement Pro Crack for MacOS New Version Latest 2025
bashirkhan333g
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Comprehensive Risk Assessment Module for Smarter Risk Management
EHA Soft Solutions
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Tally software_Introduction_Presentation
AditiBansal54083
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 

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();
  • 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.