fork download
  1. class TForm
  2. {
  3. };
  4.  
  5. // 把TFrm1 跟 TFrm2 相同的data跟function抽出來
  6. class MyFormTemplate : public TForm
  7. {
  8. public:
  9. // 相同的data
  10. int i;
  11. // 相同的function
  12. void func() { ++i; };
  13. };
  14.  
  15. class TFrm1 : public MyFormTemplate
  16. {
  17. public:
  18. int a;
  19.  
  20. void func1();
  21. };
  22.  
  23. class TFrm2 : public MyFormTemplate
  24. {
  25. public:
  26. int b;
  27.  
  28. void func2();
  29. };
  30.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/lib/gcc/i686-pc-linux-gnu/4.3.4/../../../crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
stdout
Standard output is empty