Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

There are 2 classes, 1 LandAnimal and another WaterAnimal.
There is another class Animal which wants to have the
properties of both LandAnimal and WaterAnimal. How will you
design this situation?

Answer Posted / sahaj

[note:landanimal and wateranimal both behave as base class
and the other one behave as derieved class]

#include<iostream.h>
#include<conio.h>
class landanimal
{
void print();
{
cout<<"this is base class"<<endl;
}};
class wateranimal
{
void display();
{
cout<<"this is another base class"<<endl:
}};
class animal:public landanimal,public wateranimal
{
void disp();
{
cout<<"this is derieved class"<<endl;
}};
void main()
{
animal a;
a.print();
a.display();
a.disp();
getch();
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the memory leak in java?

989


What is a cup of java?

989


What does java edition mean?

1078


What are the different types of java?

1022


Why arraylist is used in java?

1037


Why are arrays useful in java?

999


What are the topics in advance java?

936


Write a program in java to establish a connection between client and server?

943


Is a method a function?

1023


Which collection does not allow duplicates in java?

942


How are destructors defined in java?

1006


Define max and min heap, also the search time of heap.

1000


What is a layout manager and what are different types of layout managers available in java awt?

1221


You're given a Boolean 2D matrix, can you find the number of islands?

1063


What is java english?

950