fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class UiControl
  5. {
  6. protected:
  7. UiControl()
  8. {
  9. //The constructor UiControl is private, only objects of subclasses can be created
  10. }
  11.  
  12. public:
  13. int x;
  14. int y;
  15.  
  16. int width;
  17. int height;
  18.  
  19. enum TypeTag { BUTTON, TEXT_FIELD };
  20. TypeTag typeTag;
  21. };
  22.  
  23. class Button : public UiControl
  24. {
  25. public:
  26. Button() : UiControl() {}
  27.  
  28. void foo() {
  29. auto x = this->typeTag; //Fehler: this->typeTag existiert nicht
  30. }
  31. };
  32.  
  33. int main() {
  34. Button b;
  35. b.foo();
  36. // your code goes here
  37. return 0;
  38. }
Success #stdin #stdout 0s 3408KB
stdin
Standard input is empty
stdout
Standard output is empty