Describe what an Interface is and how it?s different from a
Class.

Answer Posted / amit upadhyay

interface is collection of abstract method.we can not
define any method in interface.we can implement that
abstract method by using the class.there is a restriction
in interface that you have to implement all the abstract
method in the class which is declared in interface.and we
can not create an object of interface.if we want to execute
the interface method then we have to implement first that
interface in any class after that create the object of
class ,then we can access execute that method


but in class we have to define the methods, which is
declered.we can also access that method through the object
of the class.

Is This Answer Correct ?    9 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a class oop?

580


Is react oop?

601


Why do we use polymorphism in oops?

564


What is an advantage of polymorphism?

578


What are the 3 pillars of oop?

603






What is variable example?

586


What is difference between multiple inheritance and multilevel inheritance?

588


What does sksksk mean in text slang?

1484


How do you define a class in oop?

610


write a program to find 2^n+1 ?

1536


assume the program must insert 4 elements from the key board and then do the following programs.sequential search(search one of the elements),using insertion sort(sort the element) and using selection sort(sort the element).

1653


What is interface in oop?

645


Why is encapsulation used?

565


Can an interface inherit a class?

548


How to use CMutex, CSemaphore in VC++ MFC

4316