Wednesday, 18 April 2012

OBJECT ORIENTED PROGRAMMING AND CPP


Basic concept of  oops:                     
                       *Objects:                
                       * Classes
                       *Data Abstraction  and Encapsulation
                       *Inheritence
                       *Polymorphism
                       *Dynamic binding
                       *Messsage passing                              

 What is the advantage of OOP?
You will get varying answers to this question depending on whom you ask. Major advantages of OOP are: 
1. Simplicity: software objects model real world objects, so the complexity is reduced and the program structure is very clear; 
2. Modularity: each object forms a separate entity whose internal workings are decoupled from other parts of the system; 
3. Modifiability: it is easy to make minor changes in the data representation or the procedures in an OO program. Changes inside a class do not affect any other part of a program, since the only public interface that the external world has to a class is through the use of methods; 
4. Extensibility: adding new features or responding to changing operating environments can be solved by introducing a few new objects and modifying some existing ones; 
5. Maintainability: objects can be maintained separately, making locating and fixing problems easier; 
6. Re-usability: objects can be reused in different programs
 *OBJECTS:
                    *Object are basic runtime entities in an object oriented system.
                    *They may represent a table of data or any item that program has to handle.

*ATTRIBUTE:
                        *A quality or feature regarded as a characteristic or inherent part of someone or something.

*DATA ABSTRACTION AND ENCAPSULATION:
                                       An abstraction denotes the essential characteristics of an object that distinguish it from all other kinds of object  and thus provide crisply defined conceptual boundaries, relative to the perspective of the viewer.

                                      *The wrapping up of data and functions into a single unit is  is known as encapsuation.
                                      *The data is not accessible to the outside world and only those functions which are wrapped in the class can access it.
                                      *This insulation of data from direct access by program is called data hiding or information hiding.Data hiding is the process by which access modifiers are used to hide the visibility of java methods and variables. They access modifiers are: public, private and protected.

ABSTRACTION:
                
*The process of hiding unwanted details from the users. And providing only importand details.

INHERITANCE:
                 *Deriving a new class from existing one.
                  *It provides reusability.
                 *Reduce the coding.
TYPES:
                   *Single Inheritance(one to one)
                  *Multilevel Inheritance(one to one to one)
                  *Multiple Inheritence(many to one)
                   *Hierarchical Inheritence(one to many)
                   *Hybrid Inhertance

POLYMORPHISM:
                        *one name having multiple forms.
                        *The process of making an operator to exhibit differnet behaviours
 in different  instatnces is knows as opertaor overloading.
                        *Using a single fucntion name to perform different types of task is 
known as function overloading.

DYNAMIC BINDING:
                       *It means that the code associated with a given procedure call is not known until the time of the call at runtime.
                       *It is assiciated with inheritance and polymorphism.

MESSAGE PASSING:
 
*AN OOP consists of a set of objects that communicate with each other.               

 *BASIC STEPS:
                    *Creatnig classes that define objects and their behavour.
                       *Creating objects from class definitions
                     *Establishing communication among objects.

 HISTORY OF C++:
                *C++ was created by Bjarney Stroustrup in 1980 at AT&T Bell Laboratories in Murray Hill in USA. 
                     *It was standardized in 1998 by the ANSI and ISO.

 OPERATORS IN C++;
                     *All C operators are valid in c++.Some new operators are
                       1)<<   insertion operator
                       2)>>  Extractoin opertaor
                       3)::    Scope resolution operator
                       4)::*   pointer to member declarator
                       5)->*  pointer to member operator
                       6).*    pointer to member operator
                       7)delete   memory release operator
                       8)endl   line feed operator
                       9)new   memory allocation operator
                       10)setw   field with operator

 MANIPULATOR:
                     *Manipulators are operators that are used to format the  data display.Commonly used manipulators are endl,setw.

FUNCTION  PROTOTYPING:
                      *It describes the function interface to the compiler by giving details such as the number and type of arguments and the type of return values.

INLINE FUNCTION:
                     
*An inline function is a function that is expanded in line when it is invoked.
                      *That is the compiler replaces  the function call with the corresponding code.

CONSTRUCTURES  AND DESTRUCTORS:
                         *Constructor is a special member function when a object is created then function will be called automatically.
                          *The constructor  that  take argument is called  as Parameterized Constructors.
                          *A copy constructor  takes a reference to an object of the same class as itself as an argument.
                          *Also default constructure and dynamic constructures.
 DESTRUCTORS:
                         *When a deustructor fuction is called the object will automatically destroyed.

*this  POINTER:
                            *this is a pointer that points to the object for which this function was called.

VIRTUAL  FUNCTION:
                                 *When we use the same function name in both the base and derived classes,the function in base class is declared as virtual using the keyword virtual.
                               *A virtual function equated to zero is called a pure virrual function.
It is a function declared in a base class that has no definition relative to the base class.

TEMPLATE:
                             
*A template can be used to create a family of classes or functions.  

No comments:

Post a Comment

Your comments and suggestions will help me to serve you better.