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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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