Top Banner

of 20

ppt oop's

Apr 04, 2018

Download

Documents

Ankesh Kunwar
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/29/2019 ppt oop's

    1/20

    OBJECT ORIENTEDPROGRAMMING

    By:-

    SHALLIN PARTAP SINGH

  • 7/29/2019 ppt oop's

    2/20

    How it started?

    Long programs were quiet complex and was

    not well organized.

    Simula 67 was the first language to introduce

    the concept of OOPS.

    Now a days called Simula: Simple Universal

    Language

    2Shallin

  • 7/29/2019 ppt oop's

    3/20

    Example procedure with two input and one output parameters in Simula:

    Begin

    Procedure RightText(T, N, FitsIn); Text T; Integer N;

    Name FitsIn; Boolean FitsIn;Begin

    Integer I;

    FitsIn := N >= T.Length;

    For i:=1 step 1 until N-T.Length do OutText(" ");

    OutText(T)End of RightText;

    RightText("Short", 30); OutImage;

    RightText("And the long one", 30);

    End of Program;Output:

    Short

    And the long one

    Shallin 3

  • 7/29/2019 ppt oop's

    4/20

    4Shallin

  • 7/29/2019 ppt oop's

    5/20

    Object Oriented Programming

    Object-oriented programming (OOP) is

    a programming paradigm that uses "objects"and their interactions to design applications

    and computer programs.

    5Shallin

  • 7/29/2019 ppt oop's

    6/20

    Fundamental Concepts

    Object

    Class

    Inheritance Encapsulation

    Polymorphism

    6Shallin

  • 7/29/2019 ppt oop's

    7/20

    Object

    Anything, having certain properties, is object.

    Data and functions are binded together to

    form an object.

    Each object has an identity and is

    distinguishable.

    Shallin 7

  • 7/29/2019 ppt oop's

    8/20

    Shallin 8

    Obj Osama Obj Kalam

    Both the objects have an identity and are distinguishable

  • 7/29/2019 ppt oop's

    9/20

    Class

    A class is a blueprintorfactorythat describes

    the nature of something.

    A class is a group of objects of same attribute

    and common behaviours.

    9Shallin

  • 7/29/2019 ppt oop's

    10/20

    Shallin 10

    Obj Osama Obj Kalam

  • 7/29/2019 ppt oop's

    11/20

    //program to show the use of object and class

    #include

    class display{

    int a,b;

    public:

    display()

    {

    a=10;b=20;

    cout

  • 7/29/2019 ppt oop's

    12/20

    Inheritance

    Subclasses(derived classes) of a class

    inheritthe attributes and behaviours

    of parent class.

    Shallin 12

  • 7/29/2019 ppt oop's

    13/20

    13Shallin

    Every Mc Donalds restaurant, in the entire world,

    inheritthe logo (a feature) from the place where it was

    already created.

  • 7/29/2019 ppt oop's

    14/20

    Encapsulation

    It is wrapping up of data and related functions

    in a single unit.

    It keeps data safe from external interference

    and misuse.

    Data hiding: hide the data of a class from

    outside world.

    Shallin 14

  • 7/29/2019 ppt oop's

    15/20

    Shallin 15

    A cycle factory model implementing concept of OOPS

  • 7/29/2019 ppt oop's

    16/20

    //program to show inheritance

    and encapsulation

    #includeclass display

    {

    int a,b;

    public:

    display(){

    a=10;

    b=20;

    cout

  • 7/29/2019 ppt oop's

    17/20

    Polymorphism

    Polymeans manyand morph meansforms,

    many forms.

    Concept of one interface that can be used to

    perform related but different tasks.

    Shallin 17

  • 7/29/2019 ppt oop's

    18/20

    Shallin 18

    Polymorphism

  • 7/29/2019 ppt oop's

    19/20

    //program to show polymorphism

    #include

    int math(int,int);

    int math(int);

    void main()

    {

    int a;

    couta;

    cout

  • 7/29/2019 ppt oop's

    20/20

    THANK YOU!

    Shallin 20