Give the implementation of the constructor

Assignment Help C/C++ Programming
Reference no: EM13937828

Consider the class declaration

class demoClass
{
public:
// assign arguments as initial values for the data members
demoClass(int a = 5, int b = 10);
// function returns the maximum of itemA and itemB
// int max() const;
private:
int itemA, itemB;
};

(a) Give the implementation of the constructor using an initialization list.

(b) Implement the member function max() as an external function.

(c) For each of the following object declarations, give the corresponding initial values for attributes itemA and itemB:

demoClass obj1(7,9); // itemA = ________ itemB = ________
demoClass obj2(12); // itemA = ________ itemB = ________
demoClass obj3; // itemA = ________ itemB = ________

(d) What is the output from each statement, assuming the previous declarations?

cout << obj2.max(); // Output: _________
cout << obj3.max(); // Output: _________

Reference no: EM13937828

Questions Cloud

What is the opportunity cost of this decision versus : What is the opportunity cost of this decision versus requiring only 3,000 pairs?
Is the education a good investment : What behavioral factors might indicate Jane's higher discount rate? What is the approximate internal rate of return for the investment in education indicated in this problem?
Finite element analysis of permanent magnet : Finite Element Analysis of Permanent Magnet synchronous Motor. This Assignment is based on simulation by using ANSYS software. We have to design the 2D Permanent Magnet Synchronous Motor in ANSYS and Extract all the parameters.
Objectives of the global reporting initiative : Identify and explain the objectives of the Global Reporting Initiative (GRI) sustainability reporting guidelines with specific reference to:
Give the implementation of the constructor : Implement the member function max() as an external function.
Performance using appropriate financial measures : Analyse the companies' 2012 and 2013 financial performance using appropriate financial measures. Investigate whether the two chosen companies link their SPMS measures (or targets) with executive rewards or compensation plans.
Do rights extend to businesses & other organizations aa well : The First Amendment to the U.S. Constitution added in 1891 as part of the Bill of Rights protects the rights of free speech, a free press, freedom to assemble or form groups and the freedom to contact and lobby government. Do you think that the ri..
Sustainability analysis of a design : ASSIGNMENT: Sustainability analysis of a design and sustainable manufacturing routes for critical parts
Experiences of network delivery based upon paid access : Differentiated services which allow for different consumer experiences of network delivery based upon paid access or similar access control provisions pose a threat to the future of internet communications.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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