subject
Computers and Technology, 24.06.2021 21:20 mitch80

Below, suppose that you have the following classes: classA and classB. Write the class into a header that is called from main. Be sure to #include , using namespace std; and any additions such as #include "pch. h" are present. class classA
{
public:
virtual void print() const;
void doubleNum();
classA(int a = 0);
private:
int x;
};
void classA::print() const
{
cout << "ClassA x: " << x << endl;
}
void classA::doubleNum()
{
x = 2 * x;
}
classA::classA(int a)
{
x = a;
}
class classB: public classA
{
public:
void print() const;
void doubleNum();
classB(int a = 0, int b = 0);
private:
int y;
};
void classB::print() const
{
classA::print();
cout << "ClassB y: " << y << endl;
}
void classB::doubleNum()
{
classA::doubleNum();
y = 2 * y;
}
classB::classB(int a, int b) : classA(a)
{
y = b;
}
What is the output of the following function main?
int main()
{
classA *ptrA;
classA objectA(2);
classB objectB(3, 5);
ptrA = &objectA;
ptrA->doubleNum();
ptrA->print();
cout << endl;
ptrA = &objectB;
ptrA ->doubleNum();
ptrA->print();
cout << endl;
return 0;
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:50
A.) generate scaffolding to create database for your application. develop all the entities identified in assignment #2. add any additional that may be identified later. b.) add data validation rules to the models that are appropriate for your application and data. c.) create links for each scaffold in the header section. part 2: application updates [30 points] a.) add two additional views to the "home" controller you created in assignment #1. b.) the two views should be named as “privacy" and "". c.) link the two newly created views in the footer section. hint: you would need to modify the “home" controller definition and create “privacy.html.erb" and “.html.erb" files in appropriate locations.
Answers: 3
question
Computers and Technology, 22.06.2019 05:00
Which two editions of windows 7 support 64 bit cpus? choose two out of professional, business, starter, or home premium.
Answers: 1
question
Computers and Technology, 23.06.2019 15:20
In a game with three frames, where will the objects on layer 1 appear? a. next to the play area b. in the middle of the game c. behind everything else d. in front of everything else
Answers: 1
question
Computers and Technology, 24.06.2019 01:00
Verify each identity[tex] \frac{csc}{cot \: x \: + \: tan \: x} = cos \: x[/tex]
Answers: 1
You know the right answer?
Below, suppose that you have the following classes: classA and classB. Write the class into a header...
Questions
question
Mathematics, 09.06.2021 18:40
question
English, 09.06.2021 18:40
question
Mathematics, 09.06.2021 18:40
Questions on the website: 13722363