GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Concepts  >  OOPS
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 2 of 63    Print  
Describe the principles of OOPS
There are three main principals of oops which are called Polymorphism, Inheritance and Encapsulation


  
Total Answers and Comments: 16 Last Update: May 28, 2008   
  
 Sponsored Links



 
 Best Rated Answer
Submitted by: rocky_garg11
 

 main principal of OOPS are

  1. Encapsulation :  binding the data and function in a unit called class is called a data encapsulation. this allow the user to hide the information for outside world and doesn't allow the other user to change or modify the internal values of class.
  2. Polymorphism: polymorphism is another strong feature of OOPS. it means one term in many forms.
  3. Inheritance: another strong property of OOPS. this feature offers to derive a new class from an existing one and acquire all the feature of the existing class the new class which get the feature from existing class called derived class and other class is called base class.


Above answer was rated as good by the following members:
kishore04410203
  Sorting Options  
  Page 1 of 2   « First    1    2    >     Last »  
August 04, 2005 07:29:31   #1  
Ayan        

RE: Describe the principles of OOPS
I think the define needsbit more ellustrationn...??
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
August 04, 2005 18:13:39   #2  
Paul        

RE: Describe the principles of OOPS
Polymorphism 
 
This ability of different objects to respond, each in its own way, to identical messages is called polymorphism. 
Polymorphism results from the fact that every class lives in its own name space. The names assigned within a class definition won't conflict with names assigned anywhere outside it. This is true both of the instance variables in an object's data structure and of the object's methods: 
 
 
Just as the fields of a C structure are in a protected name space, so are an object's instance variables.  
Method names are also protected. Unlike the names of C functions, method names aren't global symbols. The name of a method in one class can't conflict with method names in other classes; two very different classes could implement identically named methods.  
 
Method names are part of an object's interface. When a message is sent requesting an object to do something, the message names the method the object should perform. Because different objects can have different methods with the same name, the meaning of a message must be understood relative to the particular object that receives the message. The same message sent to two different objects could invoke two different methods. 
 
The main benefit of polymorphism is that it simplifies the programming interface. It permits conventions to be established that can be reused in class after class. Instead of inventing a new name for each new function you add to a program, the same names can be reused. The programming interface can be described as a set of abstract behaviors, quite apart from the classes that implement them.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
August 04, 2005 18:14:28   #3  
Paul        

RE: Describe the principles of OOPS
Inheritance  
 
The easiest way to explain something new is to start with something old. If you want to describe what a ``schooner'' is, it helps if your listeners already know what ``sailboat'' means. If you want to explain how a harpsichord works, it's best if you can assume your audience has already looked inside a piano, or has seen a guitar played, or at least is familiar with the idea of a ``musical instrument.'' 
 
The same is true if want to define a new kind of object; the description is simpler if it can start from the definition of an existing object. 
 
With this in mind, object-oriented programming languages permit you to base a new class definition on a class already defined. The base class is called a superclass; the new class is its subclass. The subclass definition specifies only how it differs from the superclass; everything else is taken to be the same. 
 
Nothing is copied from superclass to subclass. Instead, the two classes are connected so that the subclass inherits all the methods and instance variables of its superclass, much as you want your listener's understanding of ``schooner'' to inherit what they already know about sailboats. If the subclass definition were empty (if it didn't define any instance variables or methods of its own), the two classes would be identical (except for their names) and share the same definition. It would be like explaining what a ``fiddle'' is by saying that it's exactly the same as a ``violin.'' However, the reason for declaring a subclass isn't to generate synonyms, but to create something at least a little different from its superclass. You'd want to let the fiddle play bluegrass in addition to classical music.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
August 04, 2005 18:15:13   #4  
Paul        

RE: Describe the principles of OOPS
Encapsulation  
 
To design effectively at any level of abstraction, you need to be able to leave details of implementation behind and think in terms of units that group those details under a common interface. For a programming unit to be truly effective, the barrier between interface and implementation must be absolute. The interface must encapsulate the implementation--hide it from other parts of the program. Encapsulation protects an implementation from unintended actions and inadvertent access. 
In C, a function is clearly encapsulated; its implementation is inaccessible to other parts of the program and protected from whatever actions might be taken outside the body of the function. Method implementations are similarly encapsulated, but, more importantly, so are an object's instance variables. They're hidden inside the object and invisible outside it. The encapsulation of instance variables is sometimes also called information hiding. 
 
It might seem, at first, that hiding the information in instance variables would constrain your freedom as a programmer. Actually, it gives you more room to act and frees you from constraints that might otherwise be imposed. If any part of an object's implementation could leak out and become accessible or a concern to other parts of the program, it would tie the hands both of the object's implementor and of those who would use the object. Neither could make modifications without first checking with the other. 
 
Suppose, for example, that you're interested in the Faucet object being developed for the program that models water use and you want to incorporate it in another program you're writing. Once the interface to the object is decided, you don't have to be concerned as others work on it, fix bugs, and find better ways to implement it. You'll get the benefit of these improvements, but none of them will affect what you do in your program. Because you're depending solely on the interface, nothing they do can break your code. Your program is insulated from the object's implementation. 
 
Moreover, although those implementing the Faucet object would be interested in how you're using the class and might try to make sure that it meet your needs, they don't have to be concerned with the way you're writing your code. Nothing you do can touch the implementation of the object or limit their freedom to make changes in future releases. The implementation is insulated from anything that you or other users of the object might do.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
October 05, 2005 03:39:09   #5  
kapil madhur        

RE: Describe the principles of OOPS
there is four methods of oops which is polymorphim,abstraction,enheritence,encapsulation
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
November 26, 2005 07:30:06   #6  
M.Rajarajeswari        

RE: Describe the principles of OOPS
Polymorphism,Inheritence,Encapsulation,Method overloading and Method overriding,those above are the five principles.
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
March 08, 2006 20:23:10   #7  
Matt Filion        

RE: Describe the principles of OOPS
There are 4 principles of OOP. Abstraction, Ineheritance, Polymorhpism and Encapsulation.

Method Overloading and Overriding are a part of the Polymorphism principle.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
September 08, 2006 17:43:43   #8  
RAJEEV16706 Member Since: September 2006   Contribution: 7    

RE: Describe the principles of OOPS
I AGREE PIE . ABSTRACTION, POLYMORPHISM, INHERITANCE AND ENCAPSULATION.
 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
September 25, 2006 04:45:25   #9  
preeti        

RE: Describe the principles of OOPS

And how would you define Abstraction?


 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
November 24, 2006 02:54:24   #10  
Udhaya Kumar.D        

RE: Describe the principles of OOPS
Abstraction: An abstract class is a parent class that allows inheritance but can never be instantiated. Abstract classes contain one or more abstract methods that do not have implementation. These abstract methods can be defined in the derived class. Example :public abstract class Parent{ public abstract void add();}public class child : Parent{ public override void add() { }}And not like this:public abstract class Parent{ public abstract void add() { }}public class child : Parent{ public override void add() { }}
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
  Page 1 of 2   « First    1    2    >     Last »  


 
Go To Top


 Sponsored Links



 
Sponsored Links

 
Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape