fork download
  1.  
  2. #include <iostream>
  3.  
  4. class base
  5. {
  6. public:
  7. base(const char * name) {name_ = name;}
  8. const char * getName() {return name_;};
  9. private:
  10. const char * name_;
  11. };
  12. class derived : public base
  13. {
  14. public:
  15. derived(const char * name) : base(name) {}
  16. };
  17.  
  18. int main(int argc, char **argv)
  19. {
  20. derived d("test");
  21. std::cout << d.getName() << std::endl;
  22. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
test