#include <iostream>
#include <vector>
#include <string>
class Base{
std::vector<std::string> Names; //coloquei entre parenteses porque por algum motivo o string desaparece quando coloco da maneira correta
public:
void Add(std::string);
std::string Get(int);
};
void Base::Add(std::string name){
this->Names.push_back(name);
}
std::string Base::Get(int name_position){
return this->Names[name_position];
}
// classe derivada
class Derived : public Base{
public:
void New(std::string);
};
void Derived::New(std::string name){
Base::Add(name);
}
int main(){
Base base;
Derived derived;
derived.New("joao");
std::cout<<derived.Get(0);
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3RyaW5nPgoKY2xhc3MgQmFzZXsKICAgIHN0ZDo6dmVjdG9yPHN0ZDo6c3RyaW5nPiBOYW1lczsgLy9jb2xvcXVlaSBlbnRyZSBwYXJlbnRlc2VzIHBvcnF1ZSBwb3IgYWxndW0gbW90aXZvIG8gc3RyaW5nIGRlc2FwYXJlY2UgcXVhbmRvIGNvbG9jbyBkYSBtYW5laXJhIGNvcnJldGEKICAgIHB1YmxpYzoKICAgICAgICB2b2lkIEFkZChzdGQ6OnN0cmluZyk7CiAgICAgICAgc3RkOjpzdHJpbmcgR2V0KGludCk7Cn07CnZvaWQgQmFzZTo6QWRkKHN0ZDo6c3RyaW5nIG5hbWUpewogICAgdGhpcy0+TmFtZXMucHVzaF9iYWNrKG5hbWUpOwp9CnN0ZDo6c3RyaW5nIEJhc2U6OkdldChpbnQgbmFtZV9wb3NpdGlvbil7CiAgICByZXR1cm4gdGhpcy0+TmFtZXNbbmFtZV9wb3NpdGlvbl07Cn0KLy8gY2xhc3NlIGRlcml2YWRhCmNsYXNzIERlcml2ZWQgOiBwdWJsaWMgQmFzZXsKICAgIHB1YmxpYzoKICAgICAgICB2b2lkIE5ldyhzdGQ6OnN0cmluZyk7Cn07CnZvaWQgRGVyaXZlZDo6TmV3KHN0ZDo6c3RyaW5nIG5hbWUpewogICAgQmFzZTo6QWRkKG5hbWUpOwp9CgppbnQgbWFpbigpewogICAgQmFzZSBiYXNlOwogICAgRGVyaXZlZCBkZXJpdmVkOwogICAgZGVyaXZlZC5OZXcoImpvYW8iKTsKICAgIHN0ZDo6Y291dDw8ZGVyaXZlZC5HZXQoMCk7CiAgICAKICAgIHJldHVybiAwOwp9