夜光序言:
“虚惊一场”这四个字是人世间最美好的成语,比起什么兴高采烈,五彩缤纷,一帆风顺都要美好百倍。
你可懂什么叫失去?
正文:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 内部类测试1
{
/// <summary>
/// 夜光:先定义一个A
/// </summary>
class A
{
int i;//默认是私有的private
public class B
{
//写一个方法
public int GetAI(A a)
{
return a.i; //这样写会不会报错?嗯唔
}
}
/* public B CreateB()
{
return new B();
}*/
}
class Program
{
static void Main(string[] args)
{
//new一下
A a = new A();
// a.CreateB();
A.B b = new A.B();
int ai =b.GetAI(a);
Console.WriteLine(ai);
Console.ReadLine();
}
}
}