Untitled

 avatar
unknown
plain_text
3 years ago
371 B
5
Indexable
#include <string>
#include <iostream>
using namespace std;
struct S {
    string name_;
    S(string const& name) : name_(name) { cout << "create " << name << endl; }
    ~S() { cout << "destroy " << name_ << endl; }
};

S one("one");

int main() {
    S two("two");
    //eleven.name_; error 'eleven' was not declared in this scope
}

S eleven("eleven");
Editor is loading...