--%>

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 : Generating uniform random numbers using

    In .NET, write a simple web service in C# to generate uniform random numbers. Use the class System.Random to generate the random numbers. What part of the code is specifically associated with web services? How could you deploy the web service?

  • Q : Including CSS with the HTML Tag Explain

    Explain how to include the CSS within the HTML Tag?

  • Q : Describe Timers Timers: While time

    Timers: While time values usually cannot be reduced in the target system, their usage can be encapsulated as an abstraction which can be replaced easily (e.g., by a non-deterministic choice) during model checking.

  • Q : Task decomposition and Data

    Discuss the idea of task decomposition and data decomposition within the perspective of parallel programming.

  • Q : What is Quotient Quotient: Whenever

    Quotient: Whenever integer division is executed, the outcome comprises of a quotient and a remainder. The quotient symbolizes the integer number of times which the divisor divides into the dividend. For example, in 5/3, 5 is the dividend and 3 is the

  • Q : Explain why java is so important for

    The internet aided java to the forefront of programming. And java consequently has had a deep effect on the internet. The reason for this is highly simple: java uses the universe of objects that can travel freely in cyber space. In a network, two broad categories of

  • Q : What are Logical operators Logical

    Logical operators: The operators, like &&, ||, &, | and ^ which take two Boolean operands and generate a Boolean outcome. Employed as part of a Boolean expression, frequently in the condition of the control structure.

  • Q : Explain Relative filename Relative

    Relative filename: It is a filename whose full path is associative to some point within a file system tree-frequently the present working folder (that is, directory). For example:   

  • Q : Define Binary search Binary search :

    Binary search: This is a search of sorted data, in which the middle place is examined first. The search continues with either the right or the left part of the data, therefore removing half the remaining search space. This procedure is repeated at eac

  • Q : Explain the distributed systems Explain

    Explain the distributed systems.