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:
- [Problems with the use of internal classes] No enclosing instance of type Outer is accessible. Must qualify the allocation with an enclo
- How to Solve Const variable assignment Error
- Java error: No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing
- The solution of “no matching function for call to…” in G + + compilation
- [Solved] Operator overload must take either zero or one argument error
- error LNK2038: mismatch detected for ‘RuntimeLibrary’: value ‘MDd_DynamicDebug’ does not match value ‘MTd_StaticDebug’
- 【Java】No enclosing instance of type XXX is accessible. Must qualify the allocation with an enclos…
- C++ Error: passing ” “as” ” discards qualifiers
- JAVA ERROR: The public type *** must be defined in its own file***
- C++ error: cannot bind non-const lvalue reference of type ‘myString&’ to an rvalue of type ‘m…