Abstract Properties
In this chapter you will learn:
What is abstract properties
Abstract properties are defined in the parent class and waiting for child class to provide implementation.
using System;/*j ava 2s . co m*/
public abstract class Employee
{
public abstract string Name
{
get;
}
}
class Engineer: Employee
{
string name = "Engineer";
public override string Name
{
get
{
return(name);
}
}
}
class MainClass
{
public static void Main()
{
Employee d = new Engineer();
Console.WriteLine("Name: {0}", d.Name);
}
}
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
Home » C# Tutorial » Class