New types may not be defined in a return type (c++ language compilation error, handling)

When writing a program, you need to add braces after defining a class

class Point{
public:
    Point(int a,int b);
    Point(const Point &p);
    int getx(Point p);
    int gety(Point p);
private:
    int x,y;
}

Finally, you must add a semicolon to the curly braces. The above is an error instance. There is a compilation error

ew types may not be defined in a return type

So don’t forget the semicolon at the end

class Point{
public:
    Point(int a,int b);
    Point(const Point &p);
    int getx(Point p);
    int gety(Point p);
private:
    int x,y;
};

Compiled successfully

Similar Posts: