How to do constructor chaining in C#

I know that this is supposedly a super simple question, but I’ve been struggling with the concept for some time now.

My question is, how do you chain constructors in C#?

I’m in my first OOP class, so I’m just learning. I don’t understand how constructor chaining works or how to implement it or even why it’s better than just doing constructors without chaining.

I would appreciate some examples with an explanation.

So how do how chain them?
I know with two it goes:

public SomeClass this: {0}

public SomeClass
{
    someVariable = 0
} 

But how do you do it with three, four and so on?

Again, I know this is a beginner question, but I’m struggling to understand this and I don’t know why.

9 Answers
9

Leave a Comment