会c#的麻烦进来帮下忙using System;using System.Collections.Generic;using System.Text;namespace 类{class Dog{/* static void Main(){Dog Haba = new Dog();Haba.eat();Haba.sound();}*/public void eat(){Console.WriteLine("吃啊!");}public void sou

来源:学生作业帮助网 编辑:作业帮 时间:2024/12/01 15:06:56
会c#的麻烦进来帮下忙using System;using System.Collections.Generic;using System.Text;namespace 类{class Dog{/* static void Main(){Dog Haba = new Dog();Haba.eat();Haba.sound();}*/public void eat(){Console.WriteLine(
xoP|a ?(&O\ %! #6El67h:,ZҎg=9i2b? w0:ne5 B㗚~#VY,J}Lp^O =Au$qhYI=u͈ MtEFTe=Y6`=2~ # Ò>Y2Y0PűyE#K]nX~=If9O(J9$c/o?Qk D_8'Q1IR; F)8/B EL^M!9x<},_ Kq->: $ \|t(jWyſvZzv[ƒId/QD!eK^L

会c#的麻烦进来帮下忙using System;using System.Collections.Generic;using System.Text;namespace 类{class Dog{/* static void Main(){Dog Haba = new Dog();Haba.eat();Haba.sound();}*/public void eat(){Console.WriteLine("吃啊!");}public void sou
会c#的麻烦进来帮下忙
using System;
using System.Collections.Generic;
using System.Text;
namespace 类
{
class Dog
{
/* static void Main()
{
Dog Haba = new Dog();
Haba.eat();
Haba.sound();
}*/
public void eat()
{
Console.WriteLine("吃啊!");
}
public void sound()
{
Console.WriteLine("叫啊!");
}
}
class Car
{
static void Main()
{
Car benz = new Car();
Dog Haba = new Dog();
benz.run();
Haba.eat();
Haba.sound();
}
void run()
{
Console.WriteLine("好快!");
}
public Car()
{
Console.WriteLine("ABC!");
}
}
}
我是初学者,我想问问 public car(){} 为什么“ABC!”会在最上面出来而不是最下面?

会c#的麻烦进来帮下忙using System;using System.Collections.Generic;using System.Text;namespace 类{class Dog{/* static void Main(){Dog Haba = new Dog();Haba.eat();Haba.sound();}*/public void eat(){Console.WriteLine("吃啊!");}public void sou
public car(){}是car这个类得构造函数,执行时首先执行入口函数 static void Main(),第一句Car benz = new Car();
当你new出一个car的实体对象的时候 就会走他的构造函数,所以他会出现在最上面