answersLogoWhite

0

One way would be to define a base class called fruit, from which you could derive specific types of fruit, including an orange.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

What is 4 plus 4 plus banana plus orange plus tomato plus 2 equals?

That would depend on your value assigned for banana, orange and tomato.


If orange plus banana equals brown what is a platypus plus a donkey equal to?

A kayak. Or, if orange was a fruit the new answer would be an octopus.


Drawbacks of multiple inheritance in c plus plus?

There are no drawbacks to multiple inheritance if multiple inheritance is precisely what is required to achieve your goal. If there are any drawbacks then it is only because of poor design, not multiple inheritance itself. For instance, when designing classes to simulate vehicles, an amphibious vehicle would inherit the properties of both an off-road vehicle and a marine vehicle, therefore multiple inheritance would be an appropriate usage.


Does c plus plus supports hierarchical inheritance?

Yes.


How ploymorphism and inheritance is different from that in Java and c plus plus?

C++ allows multiple inheritance while Java does not. In my opinion, multiple inheritance is not useful because it can get very confusing very quick. For polymorphism, C++ does early binding by default, while Java does late binding by default. Late binding is more useful than early binding.


Write a c plus plus programme to illustrate single inheritance?

struct A {}; // base class struct B : A {} // derived class (single inheritance).


How can a constructor be invoked at the time of inheritance in C Plus Plus?

It cannot. Inheritance is a compile-time operation. Constructors are invoked at runtime at the point of instantiation.


Demonstrate single inheritance in C plus plus?

struct base1 { // ... }; struct base2 { // ... }; struct derived1 : public base1 // single inheritance { // ... }; struct derived2 : public base1, public base2 // multiple inheritance { // ... };


Red plus yellow equals what color?

Red + Yellow = Orange


What does orange plus red equal?

red-orange


What is pink plus yellow plus white plus red?

orange


How to answer this analogy red orange Blue?

Red Orange Yellow*GreenBlue Indigo VioletRed is to Orange: Blue is to Indigo.INDIGO.AnswerRed is to orange as blue is to green. Red plus yellow is orange; blue plus yellow is green.