Simple Constructor
Just open your c++ compiler Paste this code.
#include<iostream>
#include<string>
using namespace std;
class Distance
{
public:
int count;
Distance(Distance &d)
{
count = d.count;
}
Distance(int a,int b)
{
}
Distance() : count(0)
{
}
};
int main()
{
int b,c,d;
cout<<"enter the 2 values";
cin>>b;
cin>>c;
Distance m();
m.Distance();
cout<<"number are"<<d;
}
#include<string>
using namespace std;
class Distance
{
public:
int count;
Distance(Distance &d)
{
count = d.count;
}
Distance(int a,int b)
{
}
Distance() : count(0)
{
}
};
int main()
{
int b,c,d;
cout<<"enter the 2 values";
cin>>b;
cin>>c;
Distance m();
m.Distance();
cout<<"number are"<<d;
}








0 comments: