Accenture

  www.accenture.com
  www.accenture.com

Interview Question

Associate Software Engineer Interview(Student Candidate) Bangalore (India)

Object oriented Programming

Tags:
c++
Answer

Interview Answer

1 Answer

0

Object Oriented Programming is a concept of developing instances of a class called Objects. A class is not an object in that a class is a description/definition of the encapsulated package; an object is the instantiation of the class. Each object consists of an identity, state, and a method. An easy comparison is to think of the Class like a cookie cutter and the Objects are the cookies. The class acts as the template then you can have different cookies for the objects. Further example, class (Cookie Cutter) Objects (Chocolate Chip, Peanut Butter, Raisin, and Sugar). The primary features of object oriented programming are as follows:
 Data Abstraction defines objects that represent abstract actors that can perform work, report on and change their state and communicate with other objects in the system.
Encapsulation is the process of packaging together all the data the current class needs to know. It is also used to refer to one of two related but distinct notions, and sometimes to the combination. This means that the internal representation of an object is generally hidden from view outside the objects definition. Normally only the objects own methods can directly inspect of manipulate its fields. Refer to public/private which are access specifiers and that they do not hide any information. Information hiding is accomplished buy furnishing a compiled version of the source code that is interfaced via a header file. This prevents users from setting the internal data of the component into an invalid or inconsistent state. A Benefit of encapsulation is that it can reduce system complexity, and thus increase robustness, by allowing the developer to limit the inter-dependencies between software components.
Messaging allows for processes and objects to send and receive messages to other processes, by waiting, message processes can synchronize.
Modularity is the process of breaking down functions into modules, each of which accomplishes one function and contains everything necessary to accomplish this. This is to represent a separation of concerns and improve maintainability by enforcing logical boundaries between components. This is mostly used with interfaces. You have the main program then create sub program that all work to complete a specific job that will be utilized in the main program.
Polymorphism allows values of different data types to be handled using a uniform interface. It is that ability to create a variable, function, or an object that has more than one form. The primary usage for OOP is the ability of an object belonging to different types to respond to a method, field, or property calls of the same name, each one according to an appropriate type-specific behavior. The programmer does not have to know the exact type of object in advance, and so the exact behavior is determined at run time which can be called late binding or dynamic binding.
Inheritance is a way to reuse code of an existing object to establish a subtype from an existing object or both. This forces a common structure onto classes that share components but otherwise are different. Inheritance allows for saved time by reusing existing classes. Existing classes may be similar but not identical to classes you need. Inheritance enables you to extend the structure/functionality of an existing class so as to fit your needs.

Tyme on Aug 14, 2012

Add Answers or Comments

To comment on this Question, Sign In with Facebook or Sign Up