answer.
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
AysviL [449]
2 years ago
10

What is printed by the following program provided all necessary standard header files are included? Explain each line of the out

put by stating which member function generates the result and why to justify your answer.#include iostream> using namespace std; class A { public: virtual void f1() cout<<("fl in A/n") voidf2 () { cout << "f2 in A/n";} }class B: public A {public: void f1() cout <<"fl in B/n"; void f2() cout <<"f2 in B/n }void g(A &x){ x.f1(); x.f2(); int main(){A;aB:bg(a);g(b);a.f1();a.f2();b.f1();b.f2();}
Computers and Technology
1 answer:
Ostrovityanka [42]2 years ago
8 0

<u>Output:</u>

f1 in A

f2 in A

f1 in B

f2 in A

f1 in A

f2 in A

f1 in B

f2 in B  

<u>Explanation:</u>

In this snippet, the code makes use of virtual functions. A virtual function is defined as a function that is defined in the base class and redefined in the derived class. If the derived function accesses the virtual function, the program will get executed with the derived class’s version of the function.

In this code, we define the virtual function f1() in class A and also redefine it in class B which is the derived class of A. While executing the program, the function g which takes the object b (class B’s object) as a parameter. It will print class B’s version of f1() rather than class A’s version. This is working off the virtual function.

You might be interested in
Use the values in the range A7:A8 to extend the list of years to the range A9:A11. 3. Use AutoFill to fill the range A9:H11 with
jok3333 [9.3K]

Answer:

Question is incomplete and it needs a proper XL sheet image and more details. I have assumed and answered this question.

1. Use the values in the range A7:A8 to extend the list of years to the range A9:A11

Ans : <em>Use Ctrl + select A7: A8 and drag till A9: A11 : This will extend the list </em>

<em />

<em>2. </em>Use AutoFill to fill the range A9:H11 with the formatting from the range A7:H8.

Ans : Apply format immediately to the cells A9: H11 below with the help of Auto Fill Handle. Using Auto fill button we can able to a cell format to the cell bellow of active cell by just double clicking on the auto fill button.

3. In cell B8, create a formula without using a function that multiplies the value in cell B7 by the value in cell B6 and then adds the value in B7. Update the cell reference to cell B6, from a relative reference to a mixed reference by making an absolute reference to row 

Ans : =($B7*$B6)+$B7

4. Copy the formula from cell B8 to the range B9:B11 and then copy the formulas from the range B8:B11 to the range C8:H11.

Ans:

1. Select the cell B8 that contains which has formula to be copied

2. Click inside the formula bar to activate it and select the entire formula by using mouse and keyboard.

3. Copy the selected formula and press Esc to deactivate the formula bar.

4. Select the cell  B9 : B11 in which you want the copy of the formula to appear.

5. Most range names refer to absolute cell references. This means that when you copy a formula that uses a range name, the copied formula will use the same range name as the original.

6. Paste the formula by using references.

7. Repeat the steps of 1 to 6 for B8:B11 for range C8:H11.

5. Switch to the Cost Estimates worksheet. In cell A9, create a formula using the AVERAGE function that calculates the average of the values in the range A5:A7, then copy your formula to cell D9.

Ans : =AVERAGE(A5:A7) and Copy it to D9 using answer given in 4.

Explanation:

8 0
2 years ago
The geographic coordinate system is used to represent any location on Earth as a combination of latitude and longitude values. T
Pachacha [2.7K]

Answer:

Here is the script:  

function dd = functionDMS(dd)  

prompt= 'Enter angle in DD form ';

dd = input(prompt)

while (~checknum(dd))

if ~checknum(dd)

error('Enter valid input ');

end

dd = input(prompt)

end  

degrees = int(dd)

minutes = int(dd - degrees)

seconds = ( dd - degrees - minutes / 60 ) * 3600  

print degrees

print minutes

print seconds

print dd

Explanation:

The script prompts the user to enter an angle in decimal degree (DD) form. Next it stores that input in dd. The while loop condition checks that input is in valid form. If the input is not valid then it displays the message: Enter valid input. If the input is valid then the program converts the input dd into degrees, minutes and seconds form. In order to compute degrees the whole number part of input value dd is used. In order to compute the minutes, the value of degrees is subtracted from value of dd. The other way is to multiply remaining decimal by 60 and then use whole number part of the answer as minutes. In order to compute seconds subtract dd , degrees and minutes values and divide the answer by 60 and multiply the entire result with 3600. At the end the values of degrees minutes and seconds are printed. In MATLAB there is also a function used to convert decimal degrees to degrees minutes and seconds representation. This function is degrees2dms.

Another method to convert dd into dms is:

data = "Enter value of dd"

dd = input(data)

degrees = fix(dd);

minutes = dd - degrees;

seconds = (dd-degrees-minutes/60) *3600;

8 0
2 years ago
A client is currently struggling with late-stage integration and manual deployments. They want to find another method that will
Papessa [141]

Answer:

It can deliver the services faster with higher reliability and quality

4 0
2 years ago
The code selection above is taken from the Color Sleuth activity you just completed. This selection would count as an abstractio
Vinvika [58]

Answer:

b

Explanation:

4 0
2 years ago
How many bits would be needed to count all of the students in class today? There are 5 children in the class.
zavuch27 [327]

Answer:

You would need 8 bits.

Explanation:

If your refer back to the binary system, the exponent 2^3 would equal 8, and since there are only 5 children, this would be more reasonable. It's better to have a little bits left over than too many. Hope this helps!

4 0
2 years ago
Other questions:
  • Color of seagrass beds on navigational charts? Please quickly
    12·1 answer
  • Column, bar, pie, line, and scatter are all types of_____
    9·1 answer
  • How many frequencies does a full-duplex qam-64 modem use?
    8·2 answers
  • A form that dedicates a page for each item retrieved for a case; it allows investigators to add more detail about exactly what w
    10·1 answer
  • while investigating the settings on your SOHO router, you find two IP address reported on the devices's routing table, which is
    5·1 answer
  • Assume there is a class AirConditioner that supports the following behaviors: turning the air conditioner on and off. The follow
    7·1 answer
  • Jennifer has written a short story for children. What should be her last step before she submits the story for publication?
    11·1 answer
  • Zoom Vacuum, a family-owned manufacturer of high-end vacuums, has grown exponentially over the last few years. However, the comp
    11·1 answer
  • What email server does Global Enterprises use?
    7·1 answer
  • Write a complete Java program that: Prompts an employee to enter the number of hours that they have worked in a given week and s
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!