/*
* Constructor: It is used to initialise our classes with some initial value
*Desturctor: It is used to free up the memory used by class in our program
*sshubhamk1.page.tl
*/
#include <iostream>
* Constructor: It is used to initialise our classes with some initial value
*Desturctor: It is used to free up the memory used by class in our program
*sshubhamk1.page.tl
*/
#include <iostream>
using namespace std;
#include <conio.h>
class data
{
private:
int a;
private:
int a;
float b;
public:
//data(int x, float y): a(x),b(y) {} //initialiser list
data() //default consturcter
{
a = 10;
b = 2.5;
}
data(int x, float y) //parameterised constructer
{
a = x;
b = y;
}
data (data &d) //copy constructer
{
a = d.a;
b = d.b;
}
void show()
{
cout << "\n The value of a is "<< a;
cout << "\n The value of b is "<< b;
}
~data() //Destructer
{
cout << "Memory released";
}
};
int main()
{
data d1, d2(4,5.5), d3(d1), d4 = d2;
d1.show();
d2.show();
d3.show();
d4.show();
getch();
return 0;
}