कॉपी कंस्ट्रक्टर overloading को लागू करने के लिए C++ में एक प्रोग्राग लिखें।
Answers
Answered by
1
Answer:
// C++ program to illustrate
// Constructor overloading
#include <iostream>
using namespace std;
class construct
{
public:
float area;
// Constructor with no parameters
construct()
{
area = 0;
}
// Constructor with two parameters
construct(int a, int b)
{
area = a * b;
}
void disp()
{
cout<< area<< endl;
}
};
int main()
{
// Constructor Overloading
// with two different constructors
// of class name
construct o;
construct o2( 10, 20);
o.disp();
o2.disp();
return 1;
}
Similar questions
Physics,
2 months ago
Hindi,
2 months ago
Science,
4 months ago
Biology,
4 months ago
Social Sciences,
10 months ago