Questionclass computer publicvoid retail pricevoid int p 2

Assignment Help Computer Engineering
Reference no: EM13349290

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.

Reference no: EM13349290

Questions Cloud

Questionconsider a system with 2 multiprocessors with : questionconsider a system with 2 multiprocessors with following configurations-a machine 1 a numa machine with 2
Questionyou have been hired out as a contractor to dover : questionyou have been hired out as a contractor to dover leasing company. dover leasing is in a process of reviewing
Question 1a classify the subsequenta presentation serverb : question 1a classify the subsequenta. presentation serverb. application serverc. database serverd. software application
Questionconsider a simplified tcps aimd algorithm where : questionconsider a simplified tcps aimd algorithm where congestion window size is measured in number of segments not in
Questionclass computer publicvoid retail pricevoid int p 2 : questionclass computer publicvoid retail pricevoid int p 2 manufacturecostprintf d n p print pprivatevirtual int
Questiona queue has definite characteristics as listed : questiona queue has definite characteristics as listed below-head-the next item to exit queue is always the
Questionhocolate delights candy company manufactures : questionhocolate delights candy company manufactures several types of candy. graph a flowchart or pseudocode for
Question 1i in the creation of wines what are the : question 1i in the creation of wines what are the significant stages that are to be considered if a winery wants to
Question1 add following 16-bit 2s complement numbers : question1 add following 16-bit 2s complement numbers represented in hex assume word size of computer is 16 bits - fe59

Reviews

Write a Review

Computer Engineering Questions & Answers

  Task 1go to httppricespyconz httpwwwbuildtoorderpccom or

task 1go to httppricespy.co.nz httpwww.buildtoorderpc.com or any another source that identifies the cost of computer

  Recognizing the asset and threat

Propose the reasonable values for items in the risk register for this asset and threat, and offer the justifications for your choices.

  Developing erd on basis of crows foot model

Develop an ERD based on Crow’s Foot model, utilizing the following requirements. An INVOICE is written by a SALESREP. Each sales representative may write several invoices, however each invoice is written by the single sales representative.

  Produce the result as the user instructed on the screen

Produce the result as the user instructed on the screen with appropriate messages.

  How represent these attributes with 3nf relations

how to Represent these attributes using an E-R diagram. Provide meaningful entity names.

  Computing the effective address

An instruction is stored at the location 300 along with its address field at the location 301. The address field has value 400. A processor register R1 consists of the number 200.

  Explain the actions you will take to correct

A user calls to report that she is unable to log on to email. You respond with a couple of quick questions. Because you know that no one else is using the network right now, you cannot find out whether the problem is unique to her machine or affec..

  Create a program to read this list of prices

Wrtie down a program to read this list of prices and the sales table and calculate total dollar sales for each salesperson and the total dollar sales for all salespersons.

  Maintenance tracking application for an apartment complex

I dentify 3 variables, along with their types, that I would use in my program. Give a brief description of the variables and see if it contains any reusable components, if so, I am to mention that it does.

  Explaining the 4g lte

In January 2012, Verizon stated that the 4G LTE is available in the 190 cities covering around 200 million American subscribers. In accordance with the AT&T’s Website.

  Design c++ program to accept an n*m matrix

Write down a C++ program to accept an n*m matrix containing only 0 and 1 values, and then find it's biggest zero submatrix i.e. the biggest submatrix in which all the values are 0.

  Discuss the layered stack approach

This is meant as a discussion topic, this is not an essay. Describe the OSI and TCP/IP reference models. express  the similarities and differences between them. consider how the layered stack approach assists in our understanding of these referenc..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd