DEV Community

Cover image for All About Overloading C# Constructors
Bradley Wells
Bradley Wells

Posted on


All About Overloading C# Constructors

For a given class in C#, you may need different ways to pass arguments to it. You can do this by overloading a constructor. This technique enables you to initialize objects of the same class in different ways using a single class definition.

For example, suppose you want the ability to pass in different numbers of initial parameters. Using overloaded constructors allows you to do that by defining valid states for your class and even setting initial values for the properties of your class object at the moment of instantiation.

In this tutorial, you will learn about constructor overloading by working through an example. Click through to the source for the details.


Top comments (0)