Friday, 22 March 2013

Describe different concepts of oops in delphi .

OOPs concepts are -
  1. object
  2. class
  3. encapsulation
  4. abstraction
  5. polymorphism
  6. inheritance
  7. message passing
  8. dynamic binding
BASIC CONCEPT OF OOPS:
1.OBJECTS:
An object is an abstraction of a real world entity. It may represent a person,a place, a number and icons or something else that can be modelled.Any data in an object occupy some space in memory and can communicate with each other. 
 
2.CLASSES:

A class is a collection of objects having common features .It is a user defined data types which has data members as well functions that manipulate these data's.
 
3.ABSTRACTION:

An abstract method is a virtual or dynamic method that has no implementation in the class where it is declared. Its implementation is deferred to a descendent class. Abstract methods must be declared with the directive abstract after virtual or dynamic.
 For example:

 procedure DoSomething; virtual; abstract;
 
4.ENCAPSULATION:

It is a mechanism that puts the data and function together. It is the result of hiding implementation details of an object from its user .The object hides its data to be accessed  by only those functions which are packed in the class of that object.
 
5.INHERITANCE:

It is the relationship between two classes of object such that one of the classes ,the child takes all the relevant features of other class -the parent.Inheritance bring about  re-usability.
 
6.POLYMORPHISM:

polymorphism means having many forms that in a single entity can takes more than one form.Polymorphism is implemented through operator overloading and function overloading.
 
7.DYNAMIC BINDING:

Dynamic binding is the process of resolving the function to be associated with the respective functions calls during their run time rather than compile time.

8.MESSAGE PASSING:

Every data in an object in oops that is capable of processing request known as message .All object can communicate with each other by sending message to each other.

For Ex.

  type
     TTextBox = class(TCustomControl)
       private
        procedure WMChar(var Message: TWMChar); message WM_CHAR;
        ...
     end;


No comments:

Post a Comment