Abstract
Properties
are similar to Interface Properties, Abstract
Properties are those which are defined in an Abstract class, similar to
Interface Properties they do not have any definition, we just need to define the
get {} and/or set {} accessors.
The class which inherits the abstract class will use the property and define the get {} and/or set {} accessors in the derived class.
The following example defines an abstract class with an abstract property.
abstract class AbsEmployeeThe class which inherits the abstract class will use the property and define the get {} and/or set {} accessors in the derived class.
The following example defines an abstract class with an abstract property.
{
string Name
{
get;
set;
}
}
The above abstract class is derived by the following class and the abstract property is fully defined in the derived class.
class Employee : AbsEmployee
{
private string
strName;
//
public string
Name
{
set
{
strName = value;
}
get
{
return strName;
}
}
}
No comments:
Post a Comment