Abstraction in C#
Abstraction in C#
In object-oriented software, complexity is managed by using abstraction. 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, motherboard, RAM, keyboard, LCD screen,
wireless 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, speakers works. You just need to
know how to operate the laptop by switching it on.
Note- When derived class inherited with abstract class; derived class must be override abstract
class methods.
g.MBA();
MTU m = new MTU();
m.BTech();
m.MBA();
Console.ReadLine();
}
}
}
OutputGBTU BTech Fee 50000/GBTU MBA Fee 100000/MTU BTech Fee 40000/MTU MBA Fee 800000/-
Explanation : From above example we have make one abstract class university and two abstract
methods Btech and MBA. GBTU and MTUboth are override university course fee.
University course common for both GBTU and MTU so university method BTech and MBA is
abstract.
GBTU and MTU inherited abstract method so university method must be override here.