OOS Concept - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

OOS Concept

Description:

OOS stands on Object Oriented System – PowerPoint PPT presentation

Number of Views:54
Slides: 21
Provided by: sumitimr
Tags: oos | class

less

Transcript and Presenter's Notes

Title: OOS Concept


1
  • CObject Oriented Programming


Sumit Agarwal
2
Todays session we will review
  • What is Programming Language?
  • What is OOP?
  • Why OOP?
  • Keys to OO programming
  • Why C?
  • Constructors
  • Types of Constructor
  • References

3
What Is Programming Language?
  • A programming language specifies the words and
    symbols that we can use to write a program.
  • C was developed by sir stroustrup at AT T
    Bell Lab. USA in early 1980s.
  • Major programming paradigm are
  • Procedure-Oriented Programming
  • Object-Oriented Programming

4
What Is POP?
  • Procedure-Oriented Programming is a philosophy
    where the source code of a program is split into
    functions.
  • Employs Top-Down Approach.
  • Lack of Data Hiding Concept.
  • Some examples of POP Languages are
  • C
  • Visual Basic
  • Fortran

5
POP HYPOTHESIS

6
What Is OOP?
  • Object-Oriented Programming is a philosophy
    where the source code of a program is split into
    reusable objects.
  • An instance of a class is know as an Object.
  • Languages that are based on classes are know as
    object-oriented.
  • C
  • Java

7
OOP HYPOTHESIS

8
Why Object Oriented Programming?
  • Employs Bottom-Up Approach.
  • Provides Fault Containment.
  • Cant use components (e.g., a class) in
    inappropriate ways.
  • Provides Independence between Components.
  • Design/development can be done by more than one
    person.

9
Keys To OO Programming
  • Class
  • Object
  • Data Abstraction Encapsulation
  • Inheritance
  • Polymorphism
  • Dynamic Binding
  • Message Passing

10
Why C?
  • The main aim of C is to create user defined
    data types such as class. This means we should be
    able to initialize a class type variable(object)
    when it is declared and when a variable of built
    in types goes out of scope, the compiler
    automatic destroys the variable.
  • C provides a special member function for the
    above purpose called Constructor and Destructor
    respectively.

11
The Interface In C
  • class Car
  • public
  • // visible to all the functions/methods in
    program.
  • protected
  • // Visible to member function/method with in
    its own and derived class.
  • private
  • // Visible to member function/method with in
    its class.

12
Reasons For Using C
  • Bandwagon effect  
  • Low-level and high-level features
  • Superset of C language
  • Efficient implementation
  • Multi paradigm language

13
Constructors
  • It is a special member function with the same
    name as its class which enables an object to
    initialize itself.
  • A constructor is called automatically whenever a
    new instance of a class is created.
  • If we do not specify a constructor, the compiler
    generates a default constructor for us (expects
    no parameters and has an empty body).

14
Characteristics Of Constructors
  • Constructor should be declared in the public
    section.
  • Constructor can not be inherited.
  • They do not have return types, not even void and
    therefore they can not return values.
  • They are invoked automatically when the object
    are created.
  •  

15
Types of Constructor
  • Default Constructor A constructor that accept no
    argument is called default constructor.
  • Example studentstudent() is default
    constructor.  
  • class student
  • int roll_no
  • public
  • student() //Default
    constructor
  • roll_no105

16
Parameterized Constructor
  • Parameterized Constructor The constructor that
    can take arguments are called parameterized
    constructor.
  • class student
  • int roll_no
  • public
  • student(int x)
    //Parameterized constructor
  • roll_nox
  •  

17
Copy Constructor
  • Copy Constructor The copy constructor is used to
    declare and initialized the object from another
    object.
  • class student
  • int roll_no
  • public
  • student(int x)
    //Parameterized constructor
  • roll_nox
  • student(student s)
  •  

18
Copy Constructor(Contd.)
  • roll_nos.roll_no
  • void display()
  • coutltltroll_no
  •  void main()
  • student x(100)
  • student y(x)
  • x.display()
  • y.display()

19
References
  • Graham Learning C(TMH)
  • E. Balagurusamy- Object Oriented Programming with
    C(TMH)
  • Bjarne Stroustrup- C Programming Language
    (Addison
    Wesley)
  • http//www.cplusplus.com
  •  

20
THANK YOU!!!
  •  
Write a Comment
User Comments (0)
About PowerShow.com