Hi guys! is it possible to call parameterized constructor from derived class no-parameters constructor?
To be clear - I want to override the most simple exception constructor (withpout parametrs) by other one - with string-parameter for class -

public class SetEception : ApplicationException

thanks in advance)

as I understand - it can be realized so -

public SetEception(): base(String.Format("{0}","1234")) ;
        {
            
        }

You can create as many constructors as you like. One can have no parameters, 2nd can have one, 3rd constructor can have 3 parameters and so on.
When you create a new instance of a class you then pass as many parameters as you have in those constructors. It will be called that constructor with the same number of parameters.

Can you clarify your statements from post 1 a bit better? I didnt understand it.

Edited 5 Years Ago by Mitja Bonca: n/a

Comments
+++++++

Mitja, I couldn't understand how to express constructor without variables , which calls parent constructor with variables because of specific syntax of base()-expression where there isn't a type of variable -- for example .

public SetEception(): base(String.Format("{0}","1234")) ;

is there any more way to tell the С# that the variable has definite type? (for examle - string - as it's in my case)

This question has already been answered. Start a new discussion instead.