1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Aleonysh [2.5K]
3 years ago
7

Write a C++ Programm in which inheritance is used

Computers and Technology
1 answer:
geniusboy [140]3 years ago
8 0

Answer:

// C++ program to demonstrate inheritance

#include <iostream>

using namespace std;

// base class

class Animal {

  public:

   void eat() {

       cout << "I can eat!" << endl;

   }

   void sleep() {

       cout << "I can sleep!" << endl;

   }

};

// derived class

class Dog : public Animal {

  public:

   void bark() {

       cout << "I can bark! Woof woof!!" << endl;

   }

};

int main() {

   // Create object of the Dog class

   Dog dog1;

   // Calling members of the base class

   dog1.eat();

   dog1.sleep();

   // Calling member of the derived class

   dog1.bark();

   return 0;

}

You might be interested in
To simplify input management, you are asked, neglecting the handling of exceptions, to write a keyboard class so that the input
NARA [144]

Answer:

dodtzfivlxvjgippiy0fy9eyw8re7z

3 0
3 years ago
The most important task in developing a new computer system/app is to: a) choose the most current technologies such as operating
Ede4ka [16]

Answer:

c) establish a good relationship with the user and develop detailed and complete user requirements.

Explanation:

A new computer system/app is a computer software designed to perform a group of coordinated functions, tasks, or activities for the benefit of the user. It must be designed to help people carry out an activity.

6 0
3 years ago
A wall is built of bricks. What force is being applied to each brick from the bricks above? ​
ValentinkaMS [17]

Answer:

Gravitational Pull is the force that is being applied to each brick.

5 0
3 years ago
You enjoy helping people find solutions to problems that they are having with technology. Which job might be best for you?
RUDIKE [14]

Answer: B - technical support

Explanation:

4 0
3 years ago
To permit electrical energy to be sent over long distances at high voltage, then reduced to a lower voltage for everyday use, wh
AVprozaik [17]
High-voltage direct current
7 0
3 years ago
Read 2 more answers
Other questions:
  • Approximately what percent of U.S. businesses have some form of remote work program? (from Chapter 1)
    14·1 answer
  • One example of how psychological research can be used to control harmful behavior would be __________. A. fooling individuals th
    13·2 answers
  • A help desk manager needs to know the
    15·1 answer
  • The security option in MySQL, that when enabled, limits where a file can be loaded from when using the LOAD DATA INFILE command
    6·1 answer
  • Which line in the following program contains the prototype showDub function? 1 #include 2 using namespace std; 3 void showDub(in
    12·1 answer
  • Does anyone know websites that have free to use images, such as the website "wikimedia"? I like that one the best but it doesn't
    5·1 answer
  • Plymouth Colony was originally founded by a group of people called Pilgrims. Since Plymouth did not have an official charter fro
    15·1 answer
  • Is there any quantum computer in India?​
    9·1 answer
  • Do you need a separate password for each slack channel
    13·1 answer
  • Write a function named count_vowels that accepts two arguments: a string and an empty dictionary. The function should count the
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!