The blog has moved to the new site F10Debug.com

Saturday, September 7, 2013

What is OOP ? What is Class ? What is Object ?

Many times if interviewer start with this simplest question but many people having more than 5 yrs experience struggles to answer this type of answers and things “interviews kuch bhi puchte he”. But if you are doing day to day programming then you must know what exactly the base of all programming languages. So i thought to give answer in simplest way............

What is Object Oriented Programming ? 
  • Represents concepts as "objects" that have data fields (attributes that describe the object) and associated procedures known as methods.
  • The name itself suggests its programming language which is oriented to objects.  
  •  That means it’s totally based on objects, instead of just functions and procedures.
  •   It is a technique to think real world in terms of objects.
  •  An "object" in an OOP language refers to a "instance," or type of a class. 
  •  Every object of class must have similar structure but can have different characteristics.
  •  In OOPL, objects interact with each other; have their own methods, procedures and  functions; are part of a class and may be reused in one or more program. An OOPL must  exhibit native object-oriented functions, including data abstraction, inheritance,  encapsulation, class creation and associated objects.
  • It is a problem solving technique to develop software systems. 

       Advantages / Feature:
           Simplicity:  
              It convert’s the real world objects into software model by reducing its complexity to make program structure very clear.

            Easy to modify:   
              Due to simplest structure user can easily modify objects.

           Easy to extend:
              Allow to modify and introduce new objects easily.

           Easy to Maintain:
              Objects are maintained separately, so that problems can be easily solved.

          Re-usability:
              Same objects can be reused in other projects.

       It’s most preferred programming language when it comes to biggest and more complex  project.

       We can efficiently manage memory by using OOPS. 


      What is an Object?
  • They are instance of class.
  • An object is a representation of real world entity that has two main characteristics: Attributes and Behavior.
  • Attributes and behavior of an object are defined by the class definition.
  • E.g.: Car has stationary state (attributes), accelerate is behavior.
  • E.g.: Bird has states (attributes) are: Color, Wings and Behavior are: Flying, Eating etc.  
  • Software Objects are similar to real world objects: They have attributes and Behavior.
  • A software object stores its state in fields (Variable in Programming language) and expose its behavior though functions and methods.
         
Emaple of OOP, Object & Class
            
          What is a Class?
  • A class is a data structure that may contain data members (constants and fields), function members(methods, properties, events, indexers, operators, instance constructors,destructors and static constructors), and nested types.
  • A class is declaration, a template, or a blueprint that can be used to classify objects.
  • A class describes all the attributes of objects, as well as the methods that implement the behavior of member objects.
  • Objects of class share structural and behavioral similarities.

No comments:

Post a Comment