CJCoding With Joseph
15per day
← Back to Question List

Select topics to narrow your question pool, then enable Random to jump to a random question matching your filters.

Topics:
C++ Quiz #4

Class Constructor

mediumClasses

What is the output of this code?

📄 Code

1#include <iostream>
2using namespace std;
3 
4class Dog {
5public:
6 string name;
7 Dog(string n) : name(n) {
8 cout << name << " created" << endl;
9 }
10};
11 
12int main() {
13 Dog d1("Rex");
14 Dog d2("Max");
15 return 0;
16}