Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9207403

Have any Question?


Related Questions in Computer Engineering

Please explain to me the concept of policing with emphasis

Please explain to me the concept of policing with emphasis on the "leaky bucket" mechanism

Question 1 write data to the file the program should ask

Question : 1. Write data to the file The program should ask user for an integer and write that integer to a file. Save the program as Part1.cpp. 2. Read the data from the file The program should read the data from the fi ...

A good sample of benzoic acid melts at 121-122 degrees

A good sample of benzoic acid melts at 121-122 degrees Celsius. However, a student had a sample that melted over a range, 105-115 degrees Celsius. What did the student conclude about that sample?

Describe an ethical conundrum found in a magazine or

Describe an ethical conundrum found in a magazine or newspaper article, and please give your own thoughts. Give good citations, of course.

Looping structures can be very helpful when coding an

Looping structures can be very helpful when coding an application. These are designed for iterative statements that need to happen multiple times. There are several looping structures you can utilize in C++, For, While a ...

Dud bolt is preparing for the boonta eve classic speeder

Dud Bolt is preparing for the Boonta Eve Classic speeder race and has to make a decision about which racer to bet on. He has calculated his potential payoffs and narrowed it down to two racers shown in the following tabl ...

1 a consumer has 300 to spend on goods x and y the market

1. A consumer has $300 to spend on goods X and Y. The market prices of these two goods are Px $15 and Py $5. a. What is the market rate of substitution between goods X and Y? b. Show how the consumer's opportunity set ch ...

A chest has 3 drawers d1 has two silver coins s d2 has one

A chest has 3 drawers: (D 1 ) has two silver coins (S), (D 2 ) has one silver (S) and one gold (G), and (D 3 ) has two gold (G) coins. The drawer and coin were both randomly selected. Use the law of total probability to ...

Suppose a record has the following fields in this order a

Suppose a record has the following fields in this order: A character string of length 15, an integer of 2 bytes, a SQL date, and a SQL time (no decimal point). How many bytes does the record take if: Fields can start at ...

Select two application areas for data mining not discussed

Select two application areas for data mining NOT discussed in the text book and briefly discuss how data mining is being used to solve a problem (or to explore an opportunity)?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As