---
title: "Abstraction in c# with example"  
description: "In object-oriented software, complexity is managed by using abstraction. Abstraction is a process that involves identifying the critical behavior of a"  
author: "AVADHESH PATEL"  
published: 2012-07-05  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/319/abstraction-in-c-sharp-with-example  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# Abstraction in c# with example

In object-oriented software, complexity is managed by using [abstraction](https://www.mindstick.com/articles/944/abstraction-in-c-sharp). Abstraction is a process that involves identifying the critical behavior of an object and eliminating irrelevant and complex denials. Abstraction is a process of identifying the relevant qualities and behaviors an object should possess.\

**Example**- A Laptop consists of many things such as [processor](https://www.mindstick.com/news/2830/qualcomm-s-snapdragon-8-gen-3-processor-might-arrive-earlier-than-expected), motherboard, RAM, keyboard, LCD screen, [wireless](https://www.mindstick.com/articles/13043/handy-tips-for-fixing-wireless-routers-common-problems) antenna, web camera, USB ports, battery, speakers etc. To use it, you don't need to know how internally LCD screens, keyboard, web camera, battery, wireless antenna, speaker’s works. You just need to know how to operate the laptop by switching it on.

**Note**- When [derived class](https://answers.mindstick.com/qa/30686/what-is-a-base-class-and-derived-class) inherited with [abstract class](https://www.mindstick.com/articles/1430/abstract-class); derived class must be override abstract [class methods](https://www.mindstick.com/forum/158867/what-is-the-purpose-of-the-self-keyword-in-python-class-methods).

\

##### Example of Abstraction: -

```
using System;using System.Collections.Generic;using System.Linq;namespace abstarction{    public abstract class university    {        public abstract void BTech();        public abstract void MBA();    }    public class GBTU : university    {        public override void BTech()        {            Console.WriteLine("GBTU BTech Fee 50000/-");        }        public override void MBA()        {            Console.WriteLine("GBTU MBA Fee 100000/-");        }    }    public class MTU : university    {        public override void BTech()        {            Console.WriteLine("MTU BTech Fee 40000/-");        }      public override void MBA()        {            Console.WriteLine("MTU MBA Fee 800000/-");        }    }    class Program    {        static void Main(string[] args)        {            GBTU g = new GBTU();            g.BTech();            g.MBA();            MTU m = new MTU();            m.BTech();            m.MBA();            Console.ReadLine();        }    }}
```

##### Output-

GBTU BTech Fee 50000/-

GBTU MBA Fee 100000/-

MTU BTech Fee 40000/-

MTU MBA Fee 800000/-

[Explanation](https://yourviews.mindstick.com/view/84608/what-are-hindenburg-s-allegations-against-adani-detailed-explanation) :-

1-From above example we have make one abstract class [university](https://www.mindstick.com/articles/188407/the-north-south-divide-university-cost-comparison) and two [abstract methods](https://www.mindstick.com/forum/159550/how-to-implement-an-interface-with-two-abstract-methods-by-a-lambda-expression) Btech and MBA. GBTU and MTU both are override university course fee.

2- University course common for both GBTU and MTU so university method BTech and MBA is abstract.

3-GBTU and MTU inherited [abstract method](https://www.mindstick.com/articles/23305/abstract-methods-and-class-in-c-sharp) so university method must be override here.

---

Original Source: https://www.mindstick.com/blog/319/abstraction-in-c-sharp-with-example

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
