Derived classes of an abstract class - adding methods.

N

newsgroper

I have an abstract class with some abstract methods. I created
another class that derives from the abstract method. In the derived
class I have overridden all the abstract methods. However, I tried to
create a method in the class that doesn't exist in the abstract class
and I get a compile error that says the method cannot be found in the
abstract class.

Am I to understand that I cannot add any additional methods to the
derived class and that I can only use methods that are in the abstract
classes?
 
T

Tobin Harris

I have an abstract class with some abstract methods. I created
another class that derives from the abstract method. In the derived
class I have overridden all the abstract methods. However, I tried to
create a method in the class that doesn't exist in the abstract class
and I get a compile error that says the method cannot be found in the
abstract class.

Did you remember to omit the "overrides" keyword in the method declaration?

Tobin
 
N

newsgroper

Tobin Harris said:
Did you remember to omit the "overrides" keyword in the method declaration?

Tobin

Yes, on any new methods that I add to the derived class, I don't use
the override keyword. I just do as follows...

public void MethodName()
{
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top