---
title: "Can an Abstract Class have a constructor?"  
description: "Can an Abstract Class have a constructor?"  
author: "Hemant Patel"  
published: 2017-03-02  
updated: 2020-09-16  
canonical: https://www.mindstick.com/interview/23218/can-an-abstract-class-have-a-constructor  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# Can an Abstract Class have a constructor?

Yes when we define a class to be an Abstract Class it cannot be instantiated but that does not mean an **Abstract** class cannot have a constructor. Each abstract class must have a concrete subclass which will implement the abstract methods of that abstract class.

```
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks; namespace Learn{    public abstract class Employee    {        string name;        public string Name { get { return name; } }        protected Employee(string name)        {            this.name = name;        }    }    public class EmployeeName : Employee    {        public EmployeeName()            : base("Harsh Kumar Srivastava")        {         }        static void Main(string[] args)        {            EmployeeName obj = new EmployeeName();            Console.WriteLine(obj.Name);            Console.ReadLine();        }    }}
```

## Answers

### Answer by Hemant Patel

Yes when we define a class to be an Abstract Class it cannot be instantiated but that does not mean an **Abstract** class cannot have a constructor. Each abstract class must have a concrete subclass which will implement the abstract methods of that abstract class.

```
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks; namespace Learn{    public abstract class Employee    {        string name;        public string Name { get { return name; } }        protected Employee(string name)        {            this.name = name;        }    }    public class EmployeeName : Employee    {        public EmployeeName()            : base("Harsh Kumar Srivastava")        {         }        static void Main(string[] args)        {            EmployeeName obj = new EmployeeName();            Console.WriteLine(obj.Name);            Console.ReadLine();        }    }}
```


---

Original Source: https://www.mindstick.com/interview/23218/can-an-abstract-class-have-a-constructor

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
