Why abstract is required in C#

Posted by Rajesh081725 under C# on 5/25/2017 | Points: 10 | Views : 277 | Status : [Member] | Replies : 3
Why abstract is required in C# provide real time example.

Which situation is particular required abstract class in real time project?

Time is Gold
Thanks & Regards,
Rajesh Kumar,
9962038582.



Responses

Posted by: A2H on: 5/25/2017 [Member] [MVP] Silver | Points: 25

Up
0
Down
One real time scenario is creating a baseclass for aspx page. Consider if you have a common method which you want to share across all pages in your application. Instead of duplicating the code at multiple locations you can create absract base class and then add it your page using inheritance like below


public partial class SamplePage : DemoBasePage


Thanks,
A2H
My Blog

Rajesh081725, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rajesh081725 on: 6/19/2017 [Member] Bronze | Points: 25

Up
0
Down
But every derived class should be implementing the function. so this is not one location function implement,we can access it.

Abstract class dont have rights to implement function.

Time is Gold
Thanks & Regards,
Rajesh Kumar,
9962038582.

Rajesh081725, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Morganfowler on: 6/30/2017 [Member] Starter | Points: 25

Up
0
Down
Abstract training are instructions that comprise one or more summary strategies. An summary method is a technique this is declared, but carries no implementation. Abstract training won't be instantiated, and require subclasses to offer implementations for the abstract strategies. https://www.ukassignmentshelp.co.uk/law-assignment-writing.php

Rajesh081725, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response