ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C++  >>  OOPS
 
 


 

 
 STL interview questions  STL Interview Questions
 OOPS interview questions  OOPS Interview Questions
 C++ General interview questions  C++ General Interview Questions
Question
Tell me the scenario,Where we can use interfaces or 
Abstract class.And What is the difference between 
interfaces and abstract class?
 Question Submitted By :: Mueen Khan
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Tell me the scenario,Where we can use interfaces or Abstract class.And What is the difference between interfaces and abstract class?
Answer
# 1
abstract class contains function prototypes and function
definations also
 but interface ccontains onlu function prototypes which are
used in deriving object declarations
 
Is This Answer Correct ?    1 Yes 1 No
Seshu
 
  Re: Tell me the scenario,Where we can use interfaces or Abstract class.And What is the difference between interfaces and abstract class?
Answer
# 2
there is not interface and abstrcat keyword in C++.
but in CLR and Java
 
Is This Answer Correct ?    0 Yes 2 No
Aaa
 
 
 
  Re: Tell me the scenario,Where we can use interfaces or Abstract class.And What is the difference between interfaces and abstract class?
Answer
# 3
In relation to C# (not C++):
1. Interfaces are like abstract class where all member 
functions as abstract but cannot have any data members, 
constructors or destructors. Classes using interfaces are 
forced to implement all the methods in the interface.
2. Does not implement any methods. ie only used as a 
template for derived classes to use.
3. All members of interface are public. ie in Interface you 
only have to state long Function(); but in a class you have 
to state public abstract long Function();
4. A class can have multiple inheritence with an interface 
but not a class.
5. Also structures in C# cannot inherit from other classes 
of structures but can implement an interface allowing you 
to implement more features to your class.
By using interfaces you are not making any assumptions 
about the functionality. You want to make sure your classes 
using the interfaces implement the functionality of all the 
methods in your Interface.
With all above in mind you can probably find more uses for 
an interface.
One example: You have many forms of communication like 
FileIO or database or IPC. All these forms of communication 
will need to features like Open and Close either a file or 
a connection Read or write etc. You would then define an 
interface with these features for your concrete classes. 
You can then use the Interface as a base class pointer like 
in C++ to access the derived class's functions.
 
Is This Answer Correct ?    3 Yes 0 No
Kaushik Thakrar
 

 
 
 
Other OOPS Interview Questions
 
  Question Asked @ Answers
 
What is R T T I ? Ness-Technologies3
what is virtual destructor TCS5
Difference between over loading and over ridding? CTS10
if u write a class do u write Assignment operator and copy constructor Siemens1
What is polymorphism ? Explain with examples Ness-Technologies6
what is an instance of a class  2
what is multi level inheritance give n example ? Ness-Technologies2
What is the difference between an object and a class?  2
Difference between new operator and operator new  2
What are virtual functions?  2
Why do we use virtual functions?  3
wht is major diff b/w c and c++?  2
polymorphism means? BFL2
is java purely oop Language? Infosys22
How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization? IntraLogic1
what is virtual function in c++  4
When a private constructer is being inherited from one class to another class and when the object is instantiated is the space reserved for this private variable in the memory?? Honeywell12
What do you mean by multiple inheritance and multilevel inheritance? Differentiate between them.  2
What is a scope resolution operator? HP4
what is the difference between <stdio.h>and "stdio.h"?  2
 
For more OOPS Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com