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

Answer Posted / seamus barrett

An interface represents a contract between a class and its clients (the classes and functionality that consume the class). A class that implements an interface makes available to it's clients a collection of methods and properties as defined by the interface. As a class evolves (as the code changes) the contract between class and its client remains intact so long as the interface is unchanged. This allows a class to grow without requiring its clients to be rebuilt.

Difference? A class can be instantiated into an object that provides functionality to the instantiating function while an interface cannot be instantiated.

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between encapsulation and polymorphism?

603


How do you define a class in oop?

636


What is the highest level of cohesion?

586


Can we create object of abstract class?

583


What are the benefits of polymorphism?

630






Can static class have constructor?

591


Why is polymorphism needed?

607


What is the use of oops?

627


#include #include #include #include void insert(struct btreenode **, int); void inorder(struct btreenode *); struct btreenode { struct btreenode *leftchild; struct btreenode *rightchild; int data; }; main() { struct btreenode *bt; bt=(struct btreenode *)NULL; int req,i=1,num; clrscr(); printf("Enter number of nodes"); scanf("%d",&req); while(i<=req) { printf("Enter element"); scanf("%d",&num); insert(&bt,num); i++; } inorder(bt); } void insert(struct btreenode **sr, int num) { if(*sr==NULL) { *sr=(struct btreenode *)malloc (sizeof(struct btreenode)); (*sr)->leftchild=(struct btreenode *)NULL; (*sr)->rightchild=(struct btreenode *)NULL; (*sr)->data=num; return; } else { if(num < (*sr)->data) insert(&(*sr)->leftchild,num); else insert(&(*sr)->rightchild,num); } return; } void inorder(struct btreenode *sr) { if(sr!=(struct btreenode *)NULL) { inorder(sr->leftchild); printf("\n %d",sr->data); inorder(sr->rightchild); } else return; } please Modify the given program and add two methods for post order and pre order traversals.

3263


What is pointer in oop?

543


How many human genes are polymorphic?

581


Whats oop mean?

601


what is difference between class template and template class?

2165


hi, this is raju,iam studying b.tech 2nd year,iam want know about group1 and group2 details, and we can studying without going to any instutions? please help me.

1549


What is abstraction example?

630