How to: Implement Abstract Base Classes
Use this procedure to perform the Implement Abstract Base Class IntelliSense operation. For more information, see Implement Abstract Base Class.
To implement an abstract base class using IntelliSense
Create a console application.
Place the cursor after the class Program statement.
Type : StringComparer so the class declaration becomes class Program : StringComparer.
Click the smart tag under StringComparer, and click Implement abstract class 'System.StringComparer'.
IntelliSense adds three override methods from the StringComparer class to the Program class.
using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Program : StringComparer { static void Main(string[] args) { } public override int Compare(string x, string y) { throw new Exception ("The method or operation is not implemented."); } public override bool Equals(string x, string y) { throw new Exception ("The method or operation is not implemented."); } public override int GetHashCode(string obj) { throw new Exception ("The method or operation is not implemented."); } } }
Example
A new console application created by the development environment begins with the following declaration.
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
}
}
}