|
using
System;
abstract
class Class1
{
public
int Number;
public
abstract string
Property1
{
get;
}
public
abstract int Property2
{
get;
set;
}
}
class
MainClass : Class1
{
public
override string
Property1
{
get
{
return "Prasad Cherukuri";
}
//set
//{
//Error, Should not provide implementation for set accessor
as the
//property is declared as read only in the base abstract class
//}
}
public
override int Property2
{
get
{
return Number;
}
set
{
Number
= value;
}
}
public
static void Main()
{
MainClass MC = new
MainClass();
Console.WriteLine(MC.Property1);
MC.Property2 = 100;
Console.WriteLine(MC.Property2.ToString());
}
}
|