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
Write a function called countstuff () that takes as a parameter a character array, and returns an int. The prototype must be:
PSYCHO15rus [73]

Answer:

Please kindly go to the explanation part.

Explanation:

The required function is written in Raw code below.

Function:

#include<stdio.h>

#include<ctype.h> //including required libraries

int countstuff(char s[]){ //Function countstuff

int cntUp=0,cntLow =0,cntDigits = 0,i=0,value; //declaring required variables

for(i=0;s[i]!='\0';i++){ //loop to iterate over the characters of string

if(isupper(s[i])){

cntUp++; //incrementing count of uppercase if it is uppercase character

}

else if(islower(s[i])){

cntLow++; //incrementing count of lowercase if it is lowercase character

}

else if(isdigit(s[i])){

cntDigits++; //incrementing count of digits if it is digit

}

}

value = cntUp*1000000 + cntLow*1000 + cntDigits; //counting value using formula given in question

return value; //returning the value

}

void main(){

char string[1000]; //declaring required variables

int value;

printf("Enter a String:");

scanf("%[^\n]s",string); //taking string as input

value = countstuff(string); //calling function

printf("The Value is : %d\n",value); //printing result

}

5 0
2 years ago
The IT infrastructure components should be evaluated based on their expected financial value. All of the following are used to q
vladimir2022 [97]

Answer:(A) usability

Explanation:

The term usability refers to the usage value of products, how much they can be used and their value after their use. So adding on these points usability helps to quantify the financial value of IT components.

5 0
3 years ago
With working from home now becoming a norm what is an effective network for an organization to secure its internal resources acc
Umnica [9.8K]

Answer:

Always encrypt data never store anything in plain text someone could use wireshark to pull out a data packet and if the data is not encrypted, expect things to happen.

4 0
2 years ago
The home keys on the numeric keypad are?
Eva8 [605]
4, 5 , 6 , and plus key
456+
5 0
3 years ago
Read 2 more answers
Complete the missing part of the line to allow you to read the contents of the file.
Firlakuza [10]

Answer: Sorry I’m late but the answer is open

Explanation: Edge 2021

3 0
2 years ago
Read 2 more answers
Other questions:
  • What are the 6 external parts of a computer
    14·1 answer
  • Okay so I know this is a platform for assignments but I really need a tech expert... So I had a 16 GB SD card and because of eve
    14·1 answer
  • In Microsoft Word, how would you change the amount of space that is put in after each paragraph?
    15·1 answer
  • A(n) ________ is usually a live broadcast of audio or video content. Select one: A. instant message B. webcast C. podcast D. wik
    11·2 answers
  • Which of the following economic systems leaves production decisions completely up to the producers?
    15·2 answers
  • With the range E2:E30 selected, create a new conditional formatting rule that uses a formula to apply yellow fill and bold font
    10·1 answer
  • Why is Linux widespread in academic environments?
    7·1 answer
  • What is the meaning of antimonographycationalis​
    9·2 answers
  • Provide a status report to your classmates and instructor. Describe any modifications that you have made to the design or docume
    10·1 answer
  • Top/Bottom Rules allow a user to apply conditional formatting to cells that fall within the top or bottom numbers or percentile.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!