How to override a function without redefine in c#?

You mean you want to call the base constructor from the derived constructor? Yes, you can do that with the base() construct.

public Derived(int sides)
    : base(sides)

When Square() actually isn’t a constructor (it is in your question, no return type or void) but a method, you can do it like this:

public override returntype Foo(...)
    // your adaptation

The method in the base class has to be virtual for this to work.

Browse More Popular Posts

Leave a Comment