Skip to main content

Object Oriented Programming

Object Oriented Programming


  1. Programming paradigm that represents the concept of "objects" that have data fields (attributes that describe the object) and associated procedures known as methods
  2. Programming methodology based on objects, instead of just functions and procedures
  3. Focuses on data rather than process
  4. As individual objects can be modified without affecting other aspects of the program, it is easier for programmers to structure and organize software programs
  5. Easier to update and change programs written in object-oriented languages
  6. Simula was the first object oriented programming language


Eg: C++, Java, etc.

Features of OOPS

Objects


  1. Referred as instance of class
  2. Basic run-time entities in an object-oriented system a person, a place, a bank account, a table of data, etc can be an object
  3. They occupy space in memory that keeps its state 
  4. Each object contains data and code to manipulate the data 



Classes


  1. Blue print or prototype  which defines the variables and methods common to all the objects of certain kind user defined data types that behave like the built-in types of a programming language
  2. Objects of the same class share the same properties



Data abstraction


  1. act of representing essential-features without including the details or explanations.
  2. Provides the outside view of the object
  3. Separation of essential behavior form its implementation
  4. Since the classes use the concept of data abstraction, they are known as Abstract Data Types (ADT)



Data encapsulation


  1. Mechanism of binding the data and the codes (which manipulate the data) together
  2. Most important feature of OOPS that prevents outside interference as data is not accessible to the outside world and only those functions that are wrapped in the class can access it
  3. Acts like a protective wall.



Inheritance


  1. process by which objects of one class acquire the properties of objects of another class
  2. Helps in reducing the code size as common codes can be kept in a single class called base class
  3. Emphasizes on code reusability
  4. Feature of parent class are extracted by the derived (child) class.



Polymorphism


  1. ability to take more than one form
  2. Derived from Greek word “poly-morphs” meaning many forms
  3. An operation may exhibit different behavior in different situations depending upon the types of data used in the protram.



Dynamic binding


  1. refers to the linking of a procedure call to the code to be executed in response to the call the code associated with a given procedure call is not known until the time of call at run-time associated with polymorphism and inheritance.



Message passing

refers to the linking of a procedure call to the code to be executed in response to the call
the code associated with a given procedure call is not known until the time of call at run-time
associated with polymorphism and inheritance.

Operator Overloading


  1. Making the operator perform operations differently on the user defined data type (classes)
  2. Suppose A,B ,c are different objects of same class. Then, in C=A+B, “+” can be used to subtract the data of B from A.


Advantages of OOPS


  1. Inheritance
  2. Code reusability
  3. Time saving and higher productivity
  4. Higher security (data hiding)
  5. Easy partition and distribution of work


Application of OOPs


  1. Real time Systems
  2. Simulation and Modeling
  3. Hypertext and Hypermedia
  4. Decision support system
  5. CAM/CAE/CAD System
  6. Office Automation System
  7. AI and expert system







Comments

Popular posts from this blog

What is manipulator in C++?

Answer: Manipulators are special functions that can be included in the I/O statement to alter the format parameters of a stream. Table-2 shows some important manipulator functions that are frequently used. To access these manipulators, the file < iomanip.h > should be included in program.                               Table-2               Manipulators                                                    Equivalent ios function               set...

Explanation of Graphics in C programming

   The header file graphics.h should be included to use graphics related built in functions. Again, the variable gDriver is an integer variable that specifies graphics driver to be used. Device drivers are small programs which talk directly to the hardware. Graphics drivers are a subset of device drivers and are applicable only in the graphics mode. The initialization of this variable to DETECT is to set another variable gMode to the highest resolution available for the detected driver.  The value of this variable gDriver may be another than DETECT (e.g. 1 for CGA, 9 for VGA.). The variable gMode is an integer that specifies initial graphics mode.       The built in function initgraph() is for graphics initialization. The syntax for this is as   initgraph(&graphics_driver, &graphics_mode, path_to_driver);   path_to_driver specifies the directory path where initgraph() looks for graphics drivers ( .BGI files). Thi...

Passing arrays to functions in C programming

Like any other variables, we can also pass entire array to a function. An array name can be named as an argument for the prototype declaration and in function header. When we call the function no need to subscript or square brackets. When we pass array that pass as a call by reference because the array name is address for that array. /* Program to illustrate passing array to function */ #include<stdio.h> void display(int) ; /* function prototype */ main( ) { int num[5] = {100, 20, 40, 15, 33, i ; clrscr( ) ; printf (“\n The content of array is \n”) ; for (i=0; i<5; i++) display (num[i]) ; /*Pass array element fo fun */ getch{ } ; } void display(int n) { printf (“\t%d”, n ) ; } Output:     The content of array is 100      20       40       15 3 /* Program to read 10 numbers from keyboard to store these num into array and then c...