Computer Science, asked by sherlyaishu27, 9 months ago

write a c++ program to read and print sum of the array using default constructor and parameterized constructor in c++

Answers

Answered by Anonymous
0

Answer:

// Cpp program to illustrate the

// concept of Constructors

#include <iostream>

using namespace std;

class construct {

public:

int a, b;

.................

// Default Constructor

construct()

{

a = 10;

b = 20;

}

};

int main()

{

// Default constructor called automatically

// when the object is created

construct c;

cout << "a: " << c.a << endl

<< "b: " << c.b;

return 1;

}

....

Similar questions