Assume I have a class as:
public abstract class BaseClass
{
internal abstract void Add(int i , int j);
}
a child class as:
public class Child : BaseClass
{
}
as I am inheriting Child class from BaseClass I should implement Add() method in it
but I do not want to implement Add method here is it possible? If possible how can I achieve it?
Thanks in advance
If you dont want to implement the method, you could do the following:
Mark Child as abstract too:
public abstract class Child : BaseClass { }
Or, make the method virtual:
public abstract class BaseClass
{
internal virtual void Add(int i , int j) { }
}
Or, override the method and make it virtual:
public abstract class Child : BaseClass
{
// Empty method does nothing; also could be overridden.
internal override void Add(int i , int j) { }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With