1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include 'bits/stdc++.h' using namespace std; class Q { public: // Change the type to the required type of the variable int x; int y; // Parametrized constructor void Q(int a, int b) { x = a y = b } }; int main() { Q q1(5, 6); cout << "Value of numbers passed in were: " << q1.x << " & " << q1.y << endl; return 0; } |