Hi

I want to make an abstract method. But I always get the error " cannot declare a body because it is marked abstract."
When I delete the return then I get the error than I need a return.

can someone help me please

public  abstract Graphics drawRectangle(Graphics drawarea)
        {
          return drawarea;
        }

The very definition of an abstract method in C# is a function declaration without an implementation. Non-abstract derived classes are required to provide the implementation. If you want to provide a default implementation, the method should be virtual rather than abstract.

If you want to keep it abstract just replace the body with a semicolon. That makes it a declaration rather than a definition:

public abstract Graphics drawRectangle(Graphics drawarea);

Abstract method cannot have any code implementation.
Only overriden from it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.