Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Question

class Computer {
public:
void retail Price(void) {
int p = 2* manufactureCost();
printf( "$%d / n", p); // Print p
}
private:
virtual int manufactureCost(void) {return 1000;}
};
class IBMComputer: public Computer {
private:
virtual int manufactureCost(void) {return 1500;}
};
int main(void) {
Computer *cPtr = new Computer();
IBMComputer *ibmPtr = new IBMComputer();
Computer *cibmPtr = new IBMComputer();
cPtr->retailPrice();
ibmPtr->retailPrice();
cibmPtr->retailPrice();
return 0;
}

This question asks about how function calls to retailPrice() are evaluated.

a. Explain which version of manufactureCost() is used in the call cibmPtr-> retailPrice() and why.

b. If the virtual keyword is omitted from the declaration of manufacture Cost in derived class IBMComputer, preceding code will still compile without error and execute. Will manufacture Cost be implemented as a virtual function in class IBMComputer? Use your knowledge of how C++ is implemented to clarify why or
why not.

c.It is possible for private base-class function to be declared public in derived class. Does this conflict with subtyping principles? Elucidate why or why not in a few words.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9718907

Have any Question?


Related Questions in Computer Engineering

A string in c is simply an array of characters with the

A string in C++ is simply an array of characters with the null character(\0) used to mark the end of the string. C++ provides a set of string handling function in as well as I/O functions in . With the addition of the ST ...

Hayley motorcycle company just paid a dividend of 14 today

Hayley Motorcycle Company just paid a dividend of $1.4 today, and is expected to pay a dividend in year 1 of $1.8, a dividend in year 2 of $2.3, a dividend in year 3 of $2.9, and a dividend in year 4 of $3.8. After year ...

What are some topics that must be covered in a business

What are some topics that must be covered in a business case presented to management?

What are the key principles and tenets that any educated

What are the key principles and tenets that any educated person should know regarding the science of economics and their applicability in the world today?

Two countries australia and france have their interest

Two Countries Australia and France have their interest rates to be 8% and 2 %, respectively. If their currencies trade according to 2 Australian $s buy one euro in the spot market, what will their future spot rate be in ...

Review the following scenario and complete the

Review the following scenario and complete the design. Scenario You have been asked by the Payroll department to create a program that will calculate the weekly pay for the company's 25 employees. The employee names and ...

Why is scenario manager useful to a manager wanting to use

Why is Scenario Manager useful to a manager wanting to use a model developed with Excel to help make a business decision such as whether to expand his business? When should a manager use the Excel Solver?

Refer to the figure on the previous page now assumed host a

Refer to the figure on the previous page. Now assumed Host A has a file that has been broken down into 2001 packets, of size 20Kb each. How long would it take to transmit the file if each link has a capacity of 10Mbs, pr ...

Question need to discuss on issues and security

Question: Need to discuss on issues and security vulnerabilities caused by using 4 digit pin while accessing Banking. 1) Abstract 2) Acknowledgement 3) List of Abbreviations 4) Table of contents 5) List of tables 6) List ...

Explain some of the pitfalls to watch out for when working

Explain some of the pitfalls to watch out for when working with flat files.

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As