← Back to Question List
C++ Quiz #4
Class Constructor
What is the output of this code?
📄 Code
1#include <iostream>2using namespace std;34class Dog {5public:6 string name;7 Dog(string n) : name(n) {8 cout << name << " created" << endl;9 }10};1112int main() {13 Dog d1("Rex");14 Dog d2("Max");15 return 0;16}