您的位置:首页 > 编程语言 > C#

【C#新手的白痴疑难】2016.7.28

2016-07-28 16:27 411 查看
using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace _20160728

{

class Program

{

public static int Add(int x, int y)

{

return x + y;

}

static void Main(string[] args)

{

Console.WriteLine("结果为:"+ Program.Add(3, 5));

}

}

}

1. Console.WriteLine("结果为:",Program.Add(3,5));为什么这样输入就没有任何值?

2.为什么要用public关键字?

3. Console.WriteLine("矩形的面积为:{0}",rect1.Area());为什么Area函数需要加两个括号?

4. public double Area() {return width*height;} 为什么Area后面会有两个括号?

5,.两种定义对象的方法

Rect rect1=new Rect();

rect1.width=5;

rect1.height=3;

Console.WriteLine("矩形的面积为:{0}",rect1.Area());

Rect rect2=new Rect(6,4);

Console.WriteLine("矩形的面积为:{0}",rect2.Area());

6.遇到问题“Process is terminated due to StackoverflowException”什么问题?

7.virtual 虚函数有什么用呢/

8.override

9.多重继承中,借口的定义和属性的定义的区别?

10.在类中个定义的私有成员和共有成员有什么区别?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: