fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class someType {
  5. int a;
  6. };
  7.  
  8. class Base
  9. {
  10. public:
  11. Base() {}
  12. protected:
  13. someType myObject;
  14. };
  15.  
  16. class Child:public Base
  17. {
  18. public:
  19. //constructor
  20. Child(someType x) {
  21. myObject = x;
  22. }
  23. };
  24.  
  25. int main() {
  26. // your code goes here
  27. someType a;
  28. Child d(a);
  29. return 0;
  30. }
Success #stdin #stdout 0s 3136KB
stdin
Standard input is empty
stdout
Standard output is empty