abstract£¨C# ²Î¿¼£©
//ÒÔÏÂÀ´×Ô:http://msdn.microsoft.com/zh-cn/library/sf985hc5.aspx
abstract£¨C# ²Î¿¼£©
¸üУº2007 Äê 11 ÔÂ
abstract ÐÞÊηû¿ÉÒÔºÍÀà¡¢·½·¨¡¢ÊôÐÔ¡¢Ë÷ÒýÆ÷¼°Ê¼þÒ»ÆðʹÓá£ÔÚÀàÉùÃ÷ÖÐʹÓà abstract ÐÞÊηûÒÔָʾij¸öÀàÖ»ÄÜÊÇÆäËûÀàµÄ»ùÀà¡£±ê¼ÇΪ³éÏó»ò°üº¬ÔÚ³éÏóÀàÖеijÉÔ±±ØÐëͨ¹ý´Ó³éÏóÀàÅÉÉúµÄÀàÀ´ÊµÏÖ¡£
ʾÀý
ÔÚ´ËÀýÖУ¬Àà Square ±ØÐëÌṩ Area µÄʵÏÖ£¬ÒòΪËüÅÉÉú×Ô ShapesClass£º
abstract class ShapesClass
{
abstract public int Area();
}
class Square : ShapesClass
{
int side = 0;
public Square(int n)
{
side = n;
}
// Area method is required to avoid
// a compile-time error.
public override int Area()
{
return side * side;
}
static void Main()
{
Square sq = new Square(12);
Console.WriteLine("Area of the square = {0}", sq.Area());
}
interface I
{
void M();
}
abstract class C : I
{
public abstract void M();
}
}
// Output: Area of the square = 144
³éÏóÀà¾ßÓÐÒÔÏÂÌØÐÔ£º
³éÏóÀ಻ÄÜʵÀý»¯¡£
³éÏóÀà¿ÉÒÔ°üº¬³éÏó·½·¨ºÍ³éÏó·ÃÎÊÆ÷¡£
²»ÄÜÓà sealed£¨C# ²Î¿¼£© ÐÞÊηûÐ޸ijéÏóÀ࣬ÒòΪ sealed »áʹµÃ³éÏóÀàÎÞ·¨±»¼Ì³Ð¡£
´Ó³éÏóÀàÅÉÉúµÄ·Ç³éÏóÀà±ØÐë°üÀ¨¼Ì³ÐµÄËùÓгéÏó·½·¨ºÍ³éÏó·ÃÎÊÆ÷µÄʵʵÏÖ¡£
ÔÚ·½·¨»òÊôÐÔÉùÃ÷ÖÐʹÓà abstract ÐÞÊηûÒÔָʾ·½·¨»òÊôÐÔ²»°üº¬ÊµÏÖ¡£
³éÏó·½·¨¾ßÓÐÒÔÏÂÌØÐÔ£º
³éÏó·½·¨ÊÇÒþʽµÄÐé·½·¨¡£ &nbs
Ïà¹ØÎĵµ£º
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
public partial class _Default : Syste ......
ÒÑÖªÓÐÒ»¸öXMLÎļþ£¨bookstore.xml£©ÈçÏ£º
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price> ......
public partial class shujuku_huanyuan : System.Web.UI.Page
{
SqlConnection conn = new SqlConnection(@"server=HUAZD-33\XXD33;uid=sa;pwd=111111;database=master;");
protected void Page_Load(object sender, EventArgs e)
&nbs ......
ÔÚASP.NetÒ»°ãµÄ³ÌÐò±àдÖУ¬ËùʹÓõÄÊý¾ÝÀïÃæ£¬ÈÕÆÚʱ¼äÊÇÒ»ÖÖÌØÊâµÄÊý¾ÝÀàÐÍ£¬Ò²ÊǾ³£±»Ê¹Óõġ£---µçÄԽ̳̼¼ÊõÑ§Ï°Íø
ÔÚVisual Basic.NETÖеÄÈÕÆÚʱ¼äÊý¾ÝÓÃÊýÖµµÄÊý¾ÝÀàÐͱ£´æ£¬¶øÇÒÓз¶Î§¡£
ÈÕÆÚµÄ·¶Î§Êǹ«Ôª1Äê1ÔÂ1ÈÕ¡«¹«Ôª9999Äê1 2ÔÂ3 1ÈÕ£¬Ê±¼äµÄ·¶Î§ÊÇ00£º00£º00¡«23£º59£º59¡£ÉùÃ÷¸ñÊ½È ......
C# accessÈÕÆÚ²éѯ¼Ó#
if (((string)((ComboBoxItem)cmbField.SelectedItem).Value).Equals("System.DateTime"))
{
//ÅжÏÈÕÆÚµÄ;
& ......