What is differance between Abstract and Interface
Answers were Sorted based on User's Feedback
Answer / jasbir singh
An abstract class is a class with at least one function
without definitions.
An Interface is a class which only contains function
declarations, all the functions are specifically and
separately defined later. And you can't create objects of
these classes.
Is This Answer Correct ? | 12 Yes | 1 No |
Answer / poorna chandar rao
diffrence bettwen the abstract class and interfaces
abstract class is having abstarct methods and concrete
methods abstarct class as compulosry having subclass for the
implementation abstarct methods and abstarct does not
support multiple inheritence
because one subclass extend the abstract class their is no
scope for extends for another class because it is not
support for the multiple inheritence
ex 1: abstract class one
2 class two extends one extend three (not valid)
but interface having only method signature in the interface
their is concrete method and it supports the multiple
inhirtence because
ex: interface one
class two implements one extends three(valid)
onc class implemens the interface and extends to another
class that is support the multiple inhertince
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / pankaj kumar upadhyay
abstract class contain an abstract function as well asather functions and variableand it must be defind in derived class and here we no create an object,
ex:
an SBI bank which follow the RBI Rules including it own rules.
while an interface class can contain only an abstract function, not any other functions or variables butit also must be defined in derive class .here also we dont create ao object.
ex:
an RBI follow only itself rules
Is This Answer Correct ? | 0 Yes | 0 No |
What will happen when the following code is run: int x; while(x<100) { cout<<x; x++; } 1) The computer will output "0123...99" 2) The computer will output "0123...100" 3) The output is undefined
Why static functions always uses static variables?
what is the abstract class,interface ,its difference with a programatic eg.? hi,recently i went for an interview they ask me what is abstract class ,interface and its difference I said abstract class contain abstact method ,abstract method is a method with no body.Abstract class cannot be instantiated.Abstract class is a base class it required derived class for the implementation of method. Interface is a syntactical contract that all derived class should follow it define properties ,method,events which are known as member of interface. Then They asked me what is the difference between them. I said abstract class interface 1.abstact class can implement method 1.interface cant 2.abstact class can contain constructor, 2.interface cant destructor 3.abstract class cannot support multiple 3.interface support inheritance etc Then they said some different answer I said dont no. Then they ask me when i should make abstract class for an project and when i should make interface. I said if suppose there is two class which must be having method with different logic then we sholud make abstract class. and if suppose we have two class having method .with different logic then we can make interface . Am i correct with my explaination.if not correct me .please provide me that when should we create abstract class and interface and what is difference .please help me
Give two or more real cenario of virtual function and vertual object
what is the difference between class to class type conversion and copy constructor ?
define oops concept with example
WHAT IS THE DIFFERENCE BETWEEN OBJECT BASED & OBJECT ORIENTD PROGRAMMING LANGUAGE.(GIVE AT LIST 4 PIONT)
What is the difference between C++ and java?
what about you? wahat is your object? introduce your self?
1 Answers Ajmal Perfumes, TCS,
just right the logic of it 1--> If few people are electing then every time ur candidate should win 2--> arrange books in box, if box carry weight == books weight then take another box..... find the no of box required.
write a program to find 2 power of a 5digit number with out using big int and exponent ?
What is the difference between encapsulation and polymorphism?