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

  Futures of anomaly based instruction detection scheme

Explain the futures of anomaly based instruction detection scheme.

  The actual solution of the equation shall be done

The actual solution of the equation shall be done by a function named equSolver(), which takes three coefficients as parameters and returns a structure of three fields: two roots (if they exist) and a boolean indicator, whether the roots do exist.

  Solve a single quadratic equation of the form

Write a C++ program to solve a single quadratic equation of the form - The actual solution of the equation shall be done by a function named equSolver(), which takes three coefficients as parameters and returns a structure of three fields: two root..

  Create a simple home utility auditing program.

Design, implement, test, and debug a Visual Basic® program to create a simple home utility auditing program.

  Write a program to multiply two matrices.

The values of matrices in your program can be hard-coded and any numbers you like(including the numbers of columns/rows and the values of matrices), which means you do not have to ask user to input those numbers. Of course you can do this if you w..

  Application in assembly language

Suppose we have TEGRA, a multi-core mobile processor. While writing an application in assembly language for the given device, we have two options regarding code optimization.

  Write a header for the function named subtract

Write a header for the function named subtract. Subtract returns nothing and has one double parameter named num.

  Write a c function that converts a character to upper case.

Write a C function that converts a character to upper case. The function should have the prototype char to_upper(char ch); The characters given as input to the function are assumed to be in the sets {'a', ..., 'z'} and {'A', ... , 'Z' }. Do not use a..

  Multiplying the current balance

The interest is calculated by multiplying the current balance, rate and time period which is one quarter of a year as in this case. A new balance is calculated by adding that interest.

  Write a function named fact

Write a function named "fact" that takes one integer arguments,call them "num" and returns as its values the factorial number

  Write a program that inputs a line of text into char

8.6 (Displaying Strings in Uppercase and Lowercase) Write a program that inputs a line of text into char array s[100]. Output the line in uppercase letters and in lowercase letters.

  For this program reads the first 11 characters

E main for this program reads the first 11 characters from input, saving them. It then reads 26 short integers into |vals|, and passes them and the characters to EmbedWatermark, which subtly alters the contents of vals to contain the characters. A..

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