Help needed on constructors!
Modify the default constructor to that the data member is initialized to zero in the initialization list. Provide a second constructor to allow "Integer" objects to be created and initialized with a value.
In your test program, write a function that takes an Integer object as an argument, first by value and then by reference. What do you see printed from constructors and destructors when the function is called? Explain what you understand in a few statements.
Code:
#include <iostream>
using namespace std;
//Muhammad Danish
//67
//SEECS
class R{
public:
int danish1;
int danish2;
int danish3;
R();
R(int a,int b,int c);
};
int main()
{R f;
cout<<"Danish1="<<f.danish1;
}
R::R(int a=7,int b=9,int c=7){
danish1=a;
danish2=b;
danish3=c;
}