Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
371 B
4
Indexable
Never
#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");