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

How structure elements are stored?

  The elements of a structure are always stored in contiguous memory locations. This can be illustrated as void main() {     struct student      {      int roll;      float marks;      char remarks;   };   struct student st={200,60.5,'P'};   printf("\nAddress of roll=%u",&st.roll);   printf("\nAddress of marks=%u",&st.marks);   printf("\nAddress of remarks=%u",&st.remarks);   getch(); } Output: Address of roll=65518 Address of marks=65520 Address of remarks=65524                  st.roll               st.marks                          st.remarks 200 60.5 ‘P’               65518             65520                               65524           

How containership is different than inheritance ?

               Inheritance is the mechanism of deriving properties of one class into another. While containership is mechanism in which one class contain objects of other classes as its member.                     class alpha{_ _ _ _ _ };                     class beta{_ _ _ _ _ };                      class gamma                      {                         alpha a;                         beta b;                       _ _ _ _ _ };            All objects of gamma class will contain the objects a and b, this kind of relationship is called containership or nesting.