惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
NISL@THU
NISL@THU
E
Exploit-DB.com RSS Feed
L
LINUX DO - 热门话题
L
Lohrmann on Cybersecurity
K
Kaspersky official blog
Project Zero
Project Zero
Cisco Talos Blog
Cisco Talos Blog
T
The Exploit Database - CXSecurity.com
P
Palo Alto Networks Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
S
Schneier on Security
G
GRAHAM CLULEY
The Hacker News
The Hacker News
T
Threat Research - Cisco Blogs
Scott Helme
Scott Helme
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy & Cybersecurity Law Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Cyberwarzone
Cyberwarzone
C
CERT Recently Published Vulnerability Notes
T
Tor Project blog
AWS News Blog
AWS News Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
爱范儿
爱范儿
P
Privacy International News Feed
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
S
Securelist
G
Google Developers Blog
The Last Watchdog
The Last Watchdog
Google Online Security Blog
Google Online Security Blog
美团技术团队
F
Fortinet All Blogs
小众软件
小众软件
Recorded Future
Recorded Future
V
Visual Studio Blog
B
Blog RSS Feed
H
Help Net Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Google DeepMind News
Google DeepMind News
Blog — PlanetScale
Blog — PlanetScale
博客园 - 聂微东
Stack Overflow Blog
Stack Overflow Blog
Martin Fowler
Martin Fowler
Latest news
Latest news
Spread Privacy
Spread Privacy
H
Heimdal Security Blog

博客园 - 点点滴滴

C#操作IIS的代码 恢复误删数据(SQL Server 2000)--Log Explorer 如何让ClickOnce进行手动更新(含代码) - 点点滴滴 - 博客园 BackgroundWorker 组件 获取VS.NET 自带的数据库连接对话框的数据库连接 搜索一个局域网中所有的SQL Server服务器 Application.DoEvent() 在C#使用XML注释 用IDisposable接口释放.NET资源 正确的重载operator 很好的debug有理由不用吗 C#调用API访问其它进程 ASP.NET AJAX 路线图 ASP.NET AJAX 概述 安装ASP.NET AJAX Visitor Template Method Strategy State
抽象 虚方法 接口 的区别
点点滴滴 · 2006-11-17 · via 博客园 - 点点滴滴

抽象方法:尚未实现的方法.
虚方法: 可以在该类的继承自类中改变其实现的方法.
接口:  一系列方法的声明,是一些方法特征的集合,一个接口只有方法的特征没有方法的实现.

Example:

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Abstract \r\n");
            AbstractChild aChild = new AbstractChild();
            aChild.Show();

            Console.WriteLine("\r\nVirtual \r\n");
            VirtualChild vChild = new VirtualChild();
            vChild.Show();

            Console.WriteLine("\r\n Interface \r\n");

            Child iChild = new Child();
            iChild.Show();

            Console.Read();

        }
    }

    public abstract class AbstractParent
    {
        public abstract void Show();
    }

    public class AbstractChild : AbstractParent
    {

        public override void Show()
        {
            Console.WriteLine("Child called.");
        }
    }

    public class VirtualParent
    {
        public virtual void Show()
        {
            Console.WriteLine("virtual Parent called.");
        }
    }

    public class VirtualChild : VirtualParent
    {
        public override void Show()
        {
            Console.WriteLine("virtual Child called.");
        }
    }

    public interface IParent
    {
        void Show();
    }

    public class Child : IParent
    {

        public void Show()
        {
            Console.WriteLine("Interface called.");
        }

    }
}