Express the definition of function print of the class two

Assignment Help Computer Engineering
Reference no: EM1332033

What is wrong with the following code?

class classA
{
protected:
void setx(int a);
//Postcondition: x = a
private:
int x;
};
.
.
.
int main()
{
classA aObject;

aObject.setx(4);
return 0;
}

Consider the following code:

class one
{
public:
void print() const;
//Outputs the values of x and y.
protected:
void setData(int u, int v);
//Postcondition: x = u; y = v
private:
int x;
int y;
};

class two: public one
{
public:
void setData(int a, int b, int c);
//Postcondition: x = a; y = b; z = c
void print() const;
//Outputs the values of x, y, and z.
private:
int z;
};

a. Write the definition of the function setData of the class two.
b. Write the definition of the function print of the class two.

Reference no: EM1332033

Questions Cloud

Value of understanding job analysis information : Value of understanding job analysis information - What is the value of understanding job analysis information as an operating manager?
Generate a class named realtorcommission : generate a class named RealtorCommission. Fields include the sale price of a house, the sales commission rate, and the commission. Create two constructors.
Types of employee separation : Explain how different employment laws affect human resource practices and What are the four types of employee separation?
Organizations responsible for reinforcing societal values : Should organizations be responsible for reinforcing societal values? Why or why not?
Express the definition of function print of the class two : express the definition of function print of the class two.
Methodologies for reducing employee grievances : Consider a goal of management is to reduce the number of grievances filed by union employees each year. What are some ways that the HRM staff can contribute to this goal?
Explain e-business- discuss the effectiveness of the sears : Explain e-business- discuss the effectiveness of the sears
Explain the meaning of progressive discipline : Explain the meaning of "progressive discipline" and Do you believe that progressive disciplinary systems work? Why or why not? Please explain your answer.
Define difference between a shallow copy and a deep copy : Overload the operator += for the class newString to perform the following string concatenation; suppose that s1 is "Hello" and s2 it "there". Then the statement s1 += s2; should assign "Hello there" to s1, where s1 and s2 are newString objects.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Determining the sub game-perfect equilibrium

First Al shoots targeting one of the other two gangsters. After Al, if alive, Bob shoots, targeting one of the surviving gangsters.

  Division algorithm

Divide 16 digit value N by the six digit integer D obtaining the quotient Q and remainder (or sign of remainder) R by the following division algorithms. Describe your steps and method in order to obtain the remainder.

  Cashregister requires to support a method void undo()

imagine the CashRegister needs to support a method void undo() that undoes the addition of the preceding item. This enables a cashier to quickly undo a mistake. What instance variables should you add to the CashRegister class to support this modif..

  How many register windows must be saved to memory

How many register windows must be saved to memory.

  Give the criteria on creating functions

Program code can be organized by the use of functions. What are the criteria on creating functions? For example, do you limit the function to a certain number of lines of code, to a set of common function.

  Use the master theorem to solve bound

Prove bound is right using the substitution (induction) method

  Describe the difference between dhtml and html

explain examples of JavaScript script usage in a commercial setting.

  Moidifying the depth first search

Describe how to alter the depth-first search so that every vertex v is allocated an integer label cc[v] between 1 and k.

  Explain a mitigating strategy for the risks

Briefly identify and describe a mitigating strategy for the risks.

  Modify a purchased software package

If the project team find out that the best alternative is to modify a purchased software package, then the team has several options to consider. What are they? What mus the project team take responsibility for in each case?

  Create a class titled schooltextbook in java

Write the application with an array that holds 5 instances of the SchoolTextBook class, filled without prompting the user for input. Next prompt the used to enter a field for sorting, sort array of objects based on the user input.

  Advantage and one disadvantage of virtual machine approach

Java and many other programming languages have taken approach of executing on a virtual machine, as opposed to compiling to native machine code.

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