Maximizing ASP.NET Real World, Object-Oriented Development [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Maximizing ASP.NET Real World, Object-Oriented Development [Electronic resources] - نسخه متنی

Jeffrey Putz

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید











Abstract Classes


An abstract class is a lot like an interface, except that an abstract class actually contains some code. Abstract classes may not be directly instantiated. They're designed to be used only as a base class to other classes. Listing 2.17 shows an example of an abstract class and another class that inherits it.

Listing 2.17. An abstract base class and a class that inherits it

C#


abstract class ABaseClass
{
public abstract void MyMethod()
{
// base method implementation
}
}
public class SuperClass : ABaseClass
{
public override void MyMethod()
{
// override implementation
}
}

VB.NET


MustInherit Class ABaseClass
Public MustOverride Sub MyMethod()
' base method implementation
End Sub
End Class
Public Class SuperClass
Inherits ABaseClass
Public Overrides Sub MyMethod()
' override implementation
End Sub
End Class

An example of an abstract class in the .NET Framework is the Stream class. The Stream class by itself can't be instantiated and used because it's not complete enough. Instead, it acts as the base class for a number of other classes, including NetworkStream and MemoryStream. The base Stream class has a number of useful members that are common to all of the derived classes, but the base members aren't useful without the specific implementation found in the derived classes. Check the documentation in the .NET Framework SDK for more information on these classes.


/ 171