66 888
Assignments Done
99,1%
Successfully Done
In October 2018

Answer to Question #22966 in C++ for Anna

Question #22966
Use integer (or floating-point) to represent the private data of the class. Provide a constructor function that enables an object of this class to be initialized when it is declared. The constructor should contain default values in case no initial values are provided. Provide public member functions for each of the following:
Expert's answer
#include <conio.h>
#include <iostream>

using namespace std;

class Foo
{
private:
int data;

public:
Foo(int data = 0)
{
this->data = data;
}
};

void main()
{
Foo bar();
Foo bar_2(8);
getch();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions