zoukankan      html  css  js  c++  java
  • 问题集锦

    1. try {}里有一个return语句,那么紧跟在这个try后的finally {}里的code会 不会被执行,什么时候被执行,在return前还是后?
  • 答:会执行,在return前执行。

     

    2. short s1 = 1; s1 = s1 + 1;有什么错? short s1 = 1; s1 += 1;有什么错 ?

  • 答:short s1 = 1; s1 = s1 + 1;有错,s1是short型,s1+1是int型,不能显式
  • 转化为short型。可修改为s1 =(short)(s1 + 1) 。short s1 = 1; s1 += 1正
  • 确。

    long型没关系

  •  3. 获取分数最低的记录(可能有多条) SELECT TOP 1  with ties *
      FROM [test].[dbo].[users] order by score asc

    注:使用with ties 必须 有order by

  • 4. 虚函数

    static void Main(string[] args)
            {       A a = new A(); C c = new C();  }

       public class A
        {public A(){ Console.WriteLine("DEBUG: A constructing"); this.GetYear();}

          public virtual void GetYear(){Console.WriteLine("A");}
        }

        public class B:A
        {public B():base(){Console.WriteLine("DEBUG: B constructing");this.GetYear();}

          public override void GetYear(){Console.WriteLine("B");}
        }

        public class C : B
        {public C(){Console.WriteLine("DEBUG : C constructing");this.GetYear();}

           public override void GetYear(){Console.WriteLine("C");}

    }

    DEBUG: A constructing

    A

    DEBUG: A constructing

    C

    DEBUG: B constructing

    C

    DEBUG: C constructing

    C

     

查看全文
  • 相关阅读:
    [整理]解析Json需要设置Mime
    [整理]IE11中的WebGL探秘:渲染速度超Chrome
    [转载]详解主流浏览器多进程架构:Chrome、IE
    [转载]为什么浏览器会使用多进程架构
    [整理]win7下VS2010遇到内存不足解决方发
    [整理]WebAPI中应用oData
    [转载]NodeJS优缺点及适用场景讨论
    [转载]HTML5 真的会消灭原生App吗?
    [转载]微软VS2015支持Android和iOS编程
    VC++调试基础
  • 原文地址:https://www.cnblogs.com/yuanws/p/1670669.html
  • Copyright © 2011-2022 走看看