Intel® oneAPI DPC++/C++ Compiler
Talk to fellow users of Intel® oneAPI DPC++/C++ Compiler and companion tools like Intel® oneAPI DPC++ Library, Intel® DPC++ Compatibility Tool, and Intel® Distribution for GDB*
586 Discussions

What is the code for a default constructor in C++?

AnkitTech
Beginner
323 Views

class construct
{
public:
int a, b;
construct()
{
a = 10;
b = 20;
}
}
int main()
{
construct c;
cout << "a: " << c.a << endl
<< "b: " << c.b;
return 1;
}

0 Kudos
0 Replies
Reply