csc 212

Cards (117)

  • OBJECT ORIENTED PROGRAMMING
  • DIGITAL NOTES
  • (I YEARII SEM)
  • DEPARTMENT OF CSE & IT
  • MALLA REDDY COLLEGE OF ENGINEERING & TECHNOLOGY
  • (Autonomous Institution – UGC, Govt. of India)
  • Recognized under 2(f) and 12 (B) of UGC ACT 1956 (Affiliated to JNTUH, Hyderabad, Approved by AICTE - Accredited by NBA & NAAC – 'A' Grade - ISO 9001:2015 Certified)
  • Maisammaguda, Dhulapally (Post Via. Hakimpet), Secunderabad – 500100, Telangana State, India.
  • I Year B.Tech II Sem
  • (R18A0502)OBJECT ORIENTED PROGRAMMING
  • Object oriented paradigm

    Differences between Object Oriented Programming and Procedure oriented programming
  • Basic concepts of Object Oriented Programming
    • Encapsulation
    • Inheritance
    • Polymorphism
  • Benefits of OOP

    • Reusability
    • Inheritance
    • Data Hiding
    • Reduced complexity
    • Easy to Maintain and Upgrade
    • Message Passing
    • Modifiability
  • Structure of a C++ program
    • namespace
    • Data types
    • C++ tokens
    • Identifiers
    • Variables
    • Constants
    • Operators
    • Control structures & Loops
  • C language is known as structure oriented language or procedure oriented language
  • Procedure oriented programming
    • Employs top-down programming approach
    • Program code can be executed in C++
    • Function overloading and operator overloading not possible
    • Local variables can be declared only at the beginning of the block
    • Program controls through jumps and calls to subroutines
    • Polymorphism, encapsulation and inheritance not possible
    • Data abstraction property not supported
  • C++ language
    • Incremental version of C language
    • Structure(procedure) oriented and object oriented programming language
    • File extension ".CPP"
    • Function overloading and operator overloading possible
    • Variables can be declared in inline
    • More emphasis on data rather than procedures
    • Polymorphism, encapsulation and inheritance possible
    • Data abstraction property supported
    • Data access limited with visibility modes
    • Dynamic binding supported
    • Supports all features of C language
  • Difference Between Procedure Oriented Programming (POP) & Object Oriented Programming (OOP)
    • Program divided into functions vs objects
    • Importance to functions vs data
    • Top Down vs Bottom Up approach
    • No access specifiers vs access specifiers
    • Data can move freely vs objects communicate through member functions
    • Adding new data and function not easy vs easy
    • Global data access vs controlled data access
    • No data hiding vs data hiding
    • No overloading vs overloading possible
    • Examples: C, VB, FORTRAN, Pascal vs C++, JAVA, VB.NET, C#.NET
  • Principles (or features) of object oriented programming
    • Encapsulation
    • Data abstraction
    • Polymorphism
    • Inheritance
    • Dynamic binding
    • Message passing
  • Encapsulation
    • Wrapping of data and functions together as a single unit
    • Data not accessible to outside world, only accessible through member functions
    • Prevention of data direct access by the program is called data hiding or information hiding
  • Data abstraction
    • Representing essential features without including the background details or explanation
    • Classes use the concept of abstraction and are defined as a list of attributes and member functions
    • Classes are called abstract data type (ADT)
  • Polymorphism
    • Ability to take more than one form
    • Different ways: Function overloading, Operator overloading
  • Inheritance
    • Process by which one object can acquire the properties of another
    • Derived class (sub class) inherits from base class (super class)
    • Derived part is inherited, incremental part is new code
  • Dynamic binding
    Linking of procedure call to the code to be executed at runtime
  • Message passing
    • Objects communicate by sending and receiving information
    • A message for an object is a request for execution of a procedure
  • Benefits of object oriented programming (OOPs)
    • Reusability
    • Inheritance
    • Data Hiding
    • Reduced complexity of a problem
    • Easy to Maintain and Upgrade
    • Message Passing
    • Modifiability
  • Basic structure of C++ language
    • Documentation section
    • Linking section
    • Definition section
    • Global declaration section & class declarations
    • Member function definition
    • Main function section
  • Documentation section comes first and is used to document the use of logic or reasons in your program
  • Interface
    Makes it easier to interact with external systems
  • Modifiability
    • It is easy to make minor changes in the data representation or the procedures in an OO program
    • Changes inside a class do not affect any other part of a program, since the only public interface that the external world has to a class is through the use of methods
  • Basic structure of C++ language
    • Documentation section
    • Linking section
    • Definition section
    • Global declaration section & class declarations
    • Member function definition
    • Main function
  • Documentation section
    Used to document the use of logic or reasons in your program
  • Linking section

    Tells the compiler to link the certain occurrences of keywords or functions in your program to the header files specified in this section
  • #include<iostream>
    Causes the preprocessor to add the contents of the iostream file to the program
  • cout
    A predefined object that represents the standard output stream
  • <<
    Insertion operator, causes the string in double quotes to be displayed on the screen
  • cin
    A predefined object in C++ that corresponds to the standard input stream
  • >>
    Extraction operator, extracts the value from the keyboard and assigns it to the value variable on its right
  • #define
    A compiler directive which tells the compiler whenever a keyword is found in the program, replace it with the specified value
  • Global declaration section

    Variables and class definitions which are used throughout the program (including main and other functions) are declared so as to make them global (i.e. accessible to all parts of the program)