Types of classes in c sharp:-
Hi guys,
This blog we will explain types of classes in
c #
Basically 4
types of classes available in c sharp. These are:
1:- Partial
class
2:- Static
class
3:- Abstract
class
4:-Sealed
class
Now we
discuss about all class and its functionality with in c sharp.
Partial class:-
Partial class introduced with .Net framework 2.0. It automatically generated within code behind
page. It is a special type of class allows its members like method, properties
and event to be divided into multiple source file (.cs). At compile time these
files get combined into a single class. It denoted by the keyword partial.
Adv: - It gives scope to developer simultaneously write
code.
Static class:-
1-Static class is a class we can’t be instantiated it.
2-It contains only static members.
3- It is sealed so we can’t be inherited.
4- It contains only static constractor.
Abstract class:-
1-Abstact class is a class we can’t instantiated it.
2-
An abstract class can implement methods.
3-- An abstract class can contain
constructors or destructors.
4-
It contain variables and concrete methods.
5- An abstract class cannot support multiple
inheritances.
6- It contain
access modifiers.
7-
An abstract class can contain fields.
Sealed class:-
A sealed class is a
class which cannot be inherited. A sealed class cannot be a base class.
Sometimes we may like to prevent a class being further sub classed for security
reasons. A class that can’t sub classed is called a sealed class.
Sealed class Aclass
{
}
No comments:
Post a Comment