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

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
U
Unit 42
IT之家
IT之家
Y
Y Combinator Blog
T
Tailwind CSS Blog
B
Blog
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
Jina AI
Jina AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
I
InfoQ
J
Java Code Geeks
F
Fortinet All Blogs
T
The Blog of Author Tim Ferriss
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
H
Hackread – Cybersecurity News, Data Breaches, AI and More
人人都是产品经理
人人都是产品经理
腾讯CDC
Hugging Face - Blog
Hugging Face - Blog
GbyAI
GbyAI
博客园 - 司徒正美
The GitHub Blog
The GitHub Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
L
LangChain Blog

博客园 - 左少白

oracle 找回DROP掉的表 求解,工作流点通过时,弹出窗口让用户录入审核意见 oracle 游标 c# 多态 sqlserver 按五分钟分组 查询行转列 SqlParameter序列化的问题 oracle oracle trunc (date,dd )函数 oracle 游标 对象集合转换为datatable 用C# 正则 提取HTML标签中的值? oracle decode 与 case when ,空的处理 oracle select for update sql1 同期进度,完成率 Oracle Index 相關知識 玩转DevExpress.XtraGrid.view.gridview oracle索引 在Oracle中进行大小写不敏感的查询2
c# 继承
左少白 · 2011-09-09 · via 博客园 - 左少白

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;namespace ConsoleApplication3
{
    
class Program
    {
        
static void Main(string[] args)
        {
            A a 
= new A();
            Console.WriteLine(a.ToString());
            Console.WriteLine(a.ToString2());

            a 

= new B();
            Console.WriteLine(a.ToString());
            Console.WriteLine(a.ToString2());
            Console.WriteLine(((B)a).ToString2());
            Console.ReadLine();
        }
    }
class A
    {
        
public override string ToString()
        {
            
return "A.tostring()";
        }
        
public string ToString2()
        {
            
return "A.tostring2()";

        }
    }

class B : A 
    {
        
public override string ToString()
        {
            
return "B.tostring()";
        }
        
public new  string ToString2()
        {
            
return "B.tostring2()";

        }
    }

}

结果:

A.tostring()

A.tostring2()

B.tostring()

A.tostring2()

B.tostring2()

posted @ 2011-09-09 08:30  左少白  阅读(211)  评论()    收藏  举报