Saturday, March 14, 2015

introduction of c++




What is Object Oriented Programming?

Object-oriented programming is a method of implementation in which programs are organized as collections of objects, each of which represents an instance of some class, and whose classes are all members of one or more hierarchy of classes united via inheritance relationships

Basic concept of Object-oriented programming



  • Objects
  • Classes
  • Encapsulation
  • Data Abstraction
  • Inheritance
  • Polymorphism
  • Dynamic Binding
  • Message Passing
Objects :-

Objects are the basic run-time entities in an object-oriented system. They may represent a person, a  place,  a  bank  account,  a  table  of  data  or  any  item  that  the  program  has  to  handle




       Representation of Student Object


Classes:-

We  just  mentioned  that objects contained  data,  and  code to  manipulate the data.  The  entire  set  of  data  and  code of an  object  can  be made  a  user-defined  data  type  with  the help of  a class.  In fact,  objects are variables of that  class type.

A  class  is   thus  a  collection  of  objects  of  similar  type. For  example,  mango,  apple  and  orange  are  member  of  the  class fruit. 

 Classes  are  user-defined data  types  and  behave  like  the  built-in  types  of  a programming  language

Encapsulation :-

The wrapping of data and  functions  into  a  single  unit  (called  class)  is  known  as encapsulation.  

The  data  is  not  accessible  to  the outside world, and  those functions, which  are wrapped in the class,  can  access it. 

The  insulation  of  the data  from direct  access by the program  is called data hiding  or information hiding.

Data Abstraction  :-

Abstraction  refers to  the  act of  representing  essential  features with-  out  including the background details  or  explanations

The  functions  that operate on data  are called methods or member functions.

member function holds the information.

Inheritance :-

Inheritance  is  the  process  by  which  objects  of  one  class  acquire  the  properties  of  objects  of another class. It supports the concept  of  hierarchical  classification.

In  OOP,  the  concept of  inheritance  provides  the idea  of  reusability




Polymorphism :-

Polymorphism is another important OOP concept. Polymorphism, a Greek  term, means the ability to  take  more  than  one  form. 

An  operation  may  exhibit different  behaviors  in  different instances.  This concepts is known as operator overloading.


                            Function Overloading

Dynamic Binding :-  

Binding refers  to the linking of a procedure  call to the code  to  be  executed in  response to the call. Dynamic  binding  (also  known  as  late  binding)  means  that  the  code  associated  with  a  given procedure  call  is  not  known  until  the  time  of  the  call  at  run-time.  It  is  associated  with polymorphism and inheritance. 


Message Passing  :-

Objects communicate with one another by sending  and  receiving information much the same way as  people  pass  message  to  one  another. 



Objects  have  a  life  cycle.  They  can  be  created  and  destroyed.  Communication with  an  object  is feasible as long as it is alive.





 

 






 




 

No comments:

Post a Comment