In what scenario we need to create Static Class?
Interview question-: Why we need to create a Static Class, why shouldn't we create a normal class instead of that. Real world example to explain.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Tapan PatelPosted Aug 11, 2016, 11:37 AM
Nitin SontakkePosted Aug 12, 2016, 12:11 AM
Tapan PatelPosted Aug 11, 2016, 2:31 PM
Anil ThakurPosted Aug 11, 2016, 2:28 PM
Tapan PatelPosted Aug 11, 2016, 2:22 PM
Consider the example of TFS Work Items management using C# programming. I mean through code.
If you have a requirement to write a classes (separate classes ) that deals with TFS User Story, TFS Bugs, TFS Project, think something that is common in all above classes and you will have to do no wonder what to deal with TFS items.
Connection to TFS Work Items. Also, reading the any of the work item from TFS is a common Task.
So , you can define the Abstract class which has implementation of Connecting to TFS Server, and it also has implementation of Reading the work item of type you can pass as parameter.
Let’s say the method is : List ReadTFSItem(string ItemType, int ItemNumber) . And this method return the Title and Description of the work item.
So every class that is sub-classing this Abstract class gets the advantage of this methods and if there is requirement to read certain more attributes from TFS, then this child class can always Override the methods of abstract class and write their own implementation of reading extra fields like History of that work item or stack rank or any other.
Anil ThakurPosted Aug 11, 2016, 1:47 PM
Tapan PatelPosted Aug 11, 2016, 1:25 PM
Anil ThakurPosted Aug 11, 2016, 12:23 PM
Tapan PatelPosted Aug 11, 2016, 12:10 PM
Anil ThakurPosted Aug 11, 2016, 12:05 PM
Tapan PatelPosted Aug 11, 2016, 12:01 PM
Anil ThakurPosted Aug 11, 2016, 11:49 AM
Tapan PatelPosted Aug 11, 2016, 11:45 AM
Anil ThakurPosted Aug 11, 2016, 11:41 AM
Anil ThakurPosted Aug 11, 2016, 11:29 AM
Midhun TpPosted Aug 11, 2016, 11:27 AM
Tapan PatelPosted Aug 11, 2016, 11:23 AM