What are the advantages of inheritance?

Answer Posted / shantanu

Anything that has state,behaviour,responsibilty and
identity is called an object.Getting the state and
behaviour of one, is called as inheritance.
Inheritance is the process of creating new class called as
derioved class from the existing one called as base class.
The derived class inherits all capability of base class or
add totally new feature of its own.

Is This Answer Correct ?    51 Yes 21 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is Difeerence between List obj=new ArrayList(); and ArrayList obj=new ArrayList()?

2110


What is overloading in oop?

577


What does it mean when someone says I oop?

587


What is inheritance write a program to show use of inheritance?

617


What is abstraction in oops?

591






What are properties in oop?

613


what are the different types of qualifier in java?

1847


Give an example where we have to specifically use C programming language and C++ programming language cannot be used?

1151


How oops is better than procedural?

594


What does and I oop mean in text?

625


What is persistence in oop?

677


How do you achieve polymorphism?

618


What is class and object in oops?

613


#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.

3257


What is use of overloading?

612