fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Line;
  5.  
  6. class Shape
  7. {
  8. public:
  9. Line GetTangent()
  10. {
  11. return new Line();
  12. }
  13. };
  14.  
  15. class Line : Shape
  16. {
  17.  
  18. };
  19.  
  20. int main() {
  21.  
  22. Shape s;
  23. Line line = s.GetTangent();
  24.  
  25. // your code goes here
  26. return 0;
  27. }
Compilation error #stdin compilation error #stdout 0s 3292KB
stdin
Standard input is empty
compilation info
prog.cpp: In member function ‘Line Shape::GetTangent()’:
prog.cpp:10:5: error: return type ‘class Line’ is incomplete
     {
     ^
prog.cpp:11:22: error: invalid use of incomplete type ‘class Line’
      return new Line();
                      ^
prog.cpp:4:7: error: forward declaration of ‘class Line’
 class Line;
       ^
prog.cpp: In function ‘int main()’:
prog.cpp:23:27: error: conversion from ‘void’ to non-scalar type ‘Line’ requested
  Line line = s.GetTangent();
                           ^
stdout
Standard output is empty