SlideShare uma empresa Scribd logo
1 de 16
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.

Mais conteúdo relacionado

Mais procurados

Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programmingSachin Sharma
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingAmit Soni (CTFL)
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS ConceptBoopathi K
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingMoutaz Haddara
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Javabackdoor
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#Doncho Minkov
 
Oop c++class(final).ppt
Oop c++class(final).pptOop c++class(final).ppt
Oop c++class(final).pptAlok Kumar
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++rprajat007
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Conceptsthinkphp
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented ProgrammingIqra khalil
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator OverloadingNilesh Dalvi
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops conceptsNilesh Dalvi
 
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
 
Object Oriented Programing JAVA presentaion
Object Oriented Programing JAVA presentaionObject Oriented Programing JAVA presentaion
Object Oriented Programing JAVA presentaionPritom Chaki
 

Mais procurados (20)

Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programming
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Oops ppt
Oops pptOops ppt
Oops ppt
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
 
Object Oriented Programming with Java
Object Oriented Programming with JavaObject Oriented Programming with Java
Object Oriented Programming with Java
 
Object-oriented Programming-with C#
Object-oriented Programming-with C#Object-oriented Programming-with C#
Object-oriented Programming-with C#
 
Oop Presentation
Oop PresentationOop Presentation
Oop Presentation
 
concept of oops
concept of oopsconcept of oops
concept of oops
 
Oop c++class(final).ppt
Oop c++class(final).pptOop c++class(final).ppt
Oop c++class(final).ppt
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++
 
Delegates and events in C#
Delegates and events in C#Delegates and events in C#
Delegates and events in C#
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
 
Array in c++
Array in c++Array in c++
Array in c++
 
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++
 
Object Oriented Programing JAVA presentaion
Object Oriented Programing JAVA presentaionObject Oriented Programing JAVA presentaion
Object Oriented Programing JAVA presentaion
 

Semelhante a Introduction to oop

Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingMH Abid
 
object oriented programing lecture 1
object oriented programing lecture 1object oriented programing lecture 1
object oriented programing lecture 1Geophery sanga
 
Pi j3.2 polymorphism
Pi j3.2 polymorphismPi j3.2 polymorphism
Pi j3.2 polymorphismmcollison
 
Object Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) IntroductionObject Oriented Programming (OOP) Introduction
Object Oriented Programming (OOP) IntroductionSamuelAnsong6
 
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 .NETSabith Byari
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP conceptsAhmed 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 answerJeba 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 InterfacesAhmed Nobi
 
Fundamentals of oops in .Net
Fundamentals of oops in .NetFundamentals of oops in .Net
Fundamentals of oops in .NetHarman Bajwa
 
Lecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxLecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxShaownRoy1
 

Semelhante a 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
 

Mais de colleges

introduction to machine learning
introduction to machine learningintroduction to machine learning
introduction to machine learningcolleges
 
searching technique
searching techniquesearching technique
searching techniquecolleges
 
Automata theory
Automata theoryAutomata theory
Automata theorycolleges
 
Introduction to web architecture
Introduction to web architectureIntroduction to web architecture
Introduction to web architecturecolleges
 
Enterprise application development
Enterprise application developmentEnterprise application development
Enterprise application developmentcolleges
 

Mais de 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
 

Último

Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 

Último (20)

Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 

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.