C# Abstract Properties
In this chapter you will learn:
Description
Abstract properties are defined in the parent class and waiting for child class to provide implementation.
Example
Example for C# Abstract Properties
using System;/*from w ww .ja v a 2 s . c o 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:
- What is an Indexer
- How to create an Indexer
- Example for creating an indexer
- How to create a getter only indexer