--%>

Distinct features of Object oriented programming language

Q. What are the distinct features of Object oriented programming language?

 

                  OR

 

     What is object-oriented concept of programming? Discuss with the all features?

Ans. Object-oriented programming is a new method of resolving problems with computer. The fundamental features of the Object oriented programming language are the following:

Inheritance, Encapsulation, data abstraction, polymorphism, extensively, generality, persistence, message passing, delegation, multiple inheritances.

These important features supported by Object oriented programming language are described below:

Encapsulation: Encapsulation is the mechanism that binds together code and the data it manipulates and maintains both safe from exterior interference and mistreat. One way to think about encapsulation is as a protective wrapper that prevents the code and data from being randomly accessed by other code strictly controlled with a well defined interface. To connect this to the real world, consider the automatic transmission on an automobile. It encapsulates hundreds of bits of operation about your engine, like how much you are accelerating, the pitch of the surface you are on, and the position of the shift lever. You as user have simply one method of affecting this complex encapsulation by moving the gearshift lever. You can not affect the transmission by using the single turn or with shield wipers, for example. Therefore, the gearshift lever is a well defined (indeed, unique) interface to the transmission. Moreover, what takes place inside the transmission does not affect objects outside the transmission.    

Example:

Class A

{

Int a

Void fl ()

{

  -

}

};

Data abstraction: The technique of creating new user defined data type is called as Data abstraction. In C++, class is basic defined data type. In above example class A is user defined data type.

Inheritance: Inheritance is the process by which the one object acquires the properties of another object. This is significant because it assists the concept of classification. As mentioned previously, most knowledge is made manageable by hierarchical (that is, top down) classifications. For example, a golden retriever is part of the classification dog, which is turn is part of the mammal class, which is under the large class of animal. Without the use of hierarchical each objects would need to define all of its characteristics explicitly. However by use of inheritance, an objects needs only to define those qualities that make it unique within its class. It can take over its common attributes from its parent. Thus, it is the inheritance mechanism that makes it possible for one object to be a specific instance of a more general case.

Example:

    Class A

{

...............................

};

Class B : public : A

{

};

Here A is base class and class B is derived class. B can use all the public members of base class.

Polymorphism: Polymorphism (from the Greek, meaning "many forms") is a feature that allows one interface to be used for a general class of actions. The exact action is determined by the precise nature of the situation. Assume a stack (which is a last in, first out list). You might have a programme that requires three types of stacks. One stack is used for integer values, one stack is used for floating point values and one stack is used for characters. The algorithm that executes each stack is identical, even through the data being stored differs. In a non object oriented language, you would be requires three different sets of stack routines. With each sets using different names. However, due to polymorphism, in java you can state a general set of stack routines that all share the same names. More, usually, the concept of polymorphism is often expressed by the phrase "one interface", multiple methods." This means that it is possible to design a generic interface to a group of related activities. This helps in reducing complexity by reducing to allowing the interface to be used to specify a general class of action. It is the compiler's job to select the specific action (that is, method) as it applies to each situation.

Example:

Class A

{

Void fl (Int a)

{

-

}

Void fl (Int a, Int b)

{

-

}

};

Here function fl 0 is overloaded with one argument and two arguments

Message Passing: It is the process of invoking an operation on an object. In response to a message, the corresponding method (function) is executed in the objected. In previous e.g. function fl o can invoke any data type associated with it.

Extensibility: It is a feature, which allow the extension of the functionally of the existing software component. The example used in inheritance is achieving this feature.

Persistence: The phenomenon where the object outlives the program execution time and exists between executions of a program is known as persistence.

Delegation: It is alternative to inheritance. It is a way of making object composition as powerful as inheritance.

 Generality: It is a technique for defining software components that have more than one interpretation depending upon the data type of parameters. It can be achieved through function template. Example:

Template < class T >

Return type function name (arguments)

{

Body of template function

-

}

Multiple inheritances: C++ strongly supports the concept of reusability. The C++ classes can be reused in several ways. Once a class has been written and checked, it can be adapted by other programmes to suit their requirements. This is essentially done by developing new classes, reusing the properties of the existing ones. The process of developing a new class from an old one is called inheritance (or derivation). The old class is known as the base class and the new one is called the derived class or subclass. The derived class takes over some or all of the traits from the base class. A class can also take over properties from more than one class or from more than one level. A derived class with only one base class is called single inherited class and one with several base classes multiple inherited class. Consider following:

In case first, subclass C inherits classes A and B. However, in the hierarchy on the left, C inherit both A and B at the same time. In the one of on the right, B inherit A and C inherit B. By not allowing the inheritance of multiple base cases by a single subclass, Java greatly simplifies the inheritance model. Java provides an alternate approach known as interfaces to support the concept of multiple inheritances.

   Related Questions in Programming Languages

  • Q : Basic programming help In C Language 1.

    1. In what ways are the initialization, repetition test, and update steps alike for a sentinel-controlled loop and an endfile-controlled loop? How are they different? 2. Rewrite the program segment that follows using a for loop: count = 0;

  • Q : Define Java 2 SDK Java 2 SDK : It is a

    Java 2 SDK: It is a particular implementation of the abstract functionality explained in Sun's specification of Java 2 Platform.

  • Q : What is Static method Static method :

    Static method: The static method (also termed as a class method) is one with static reserved word in its header. The static methods vary from all other methods in that they are not related with any specific instance of the class to which they fit in.

  • Q : What is First in-first out First in,

    First in, first out: It is FIFO semantics of the queue data structure. Items are eliminated in the order in which they arrived in the queue; therefore older items are always eliminated before newer ones.

  • Q : Networking Homework Assignment : A

    Homework Assignment : A Barbershop Problem Due: November 20, 2012 In this assignment, you are asked to write a multithreading problem to simulate the barbershop problem, which is a classical synchronization problem. The problem is taken from William Stallings's Operating Systems: Internals and D

  • Q : What does WSDL stand for What does WSDL

    What does WSDL stand for?

  • Q : What is Cursor Cursor : This is a

    Cursor: This is a visual representation of the existing position of the mouse on the user's virtual desktop. Cursor shapes are frequently set to symbolize the current state of a program – utilizing an hour glass shape to point out that the user

  • Q : Describe IEEE 754 IEEE 754 : The

    IEEE 754: The standard 754-1985 issued by Institute of Electrical and Electronic Engineers for the binary floating point arithmetic. It is the standard to which Java's arithmetic matches.

  • Q : Explain Throws clause Throws clause :

    Throws clause: It is a clause in a method header pointing that one or additional exceptions will be propagated from this technique. For example:    public int find(String s) throws NotFoundExc

  • Q : What is an Operator Operator : It is a

    Operator: It is a symbol, like -, = or ?: taking one, two or three operands and yielding an outcome. The operators are employed in both arithmetic and Boolean expressions.