第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

正在回答

4 回答

using System;

using System.Collections.Generic;

using System.Text;


namespace Test

{

? ? public class Pet

? ? {

? ? ? ? public string Name;

? ? ? ? public void PrintName()

? ? ? ?

? ? ? ? {

? ? ? ? ? ? Console.WriteLine("Pet's name is" + Name);

? ? ? ? }



? ? ? ? public int Age;?

? ? ? ? public void PrintAge()

? ? ? ? {

? ? ? ? ? ? Console.WriteLine("Pet's age is " + Age);

? ? ? ? }

? ? }

? ? public class dog:Pet

? ? {


? ? }

? ? public class cat:Pet

? ? {


? ? }




? ? class Program

? ? {

? ? ? ? static void Main(string[] args)

? ? ? ? {

? ? ? ? ? ? dog dog = new dog();

? ? ? ? ? ? dog.Name = "jack";

? ? ? ? ? ? dog.Age = 18;

? ? ? ? ? ? dog.PrintName();

? ? ? ? ? ? dog.PrintAge();


? ? ? ? ? ? cat cat = new cat();

? ? ? ? ? ? cat.Name = "tom";

? ? ? ? ? ? cat.Age = 3;

? ? ? ? ? ? cat.PrintName();

? ? ? ? ? ? cat.PrintAge();

? ? ? ? }

? ? }

}


0 回復(fù) 有任何疑惑可以回復(fù)我~

namespace ConsoleApplication1

{

? ? class Program

? ? {

? ? ? ? public class pet : Program

? ? ? ? {

? ? ? ? ? ? public string cat;

? ? ? ? ? ? public void name()

? ? ? ? ? ? {

? ? ? ? ? ? ? ? Console.Write("pet's name is " + cat);

? ? ? ? ? ? }

? ? ? ? }

? ? ? ? public class coffecat : pet

? ? ? ? {


? ? ? ? }

? ? ? ? static void Main(string[] args)

? ? ? ? {

? ? ? ? ? ? coffecat cats = new coffecat();

? ? ? ? ? ? cats.cat = "coffecat";

? ? ? ? ? ? cats.name();

? ? ? ? ? ? Console.ReadLine();

? ? ? ? }

? ? }

}


0 回復(fù) 有任何疑惑可以回復(fù)我~

第一,你把 類 放到 namespace 外面去了,不行哦~

第二,再console。writeline 里面 如果是一個值,不能加“”。

2 回復(fù) 有任何疑惑可以回復(fù)我~

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;


namespace protest

{

class Program

{

static void Main(string[] args)

{

dog dog1 = new dog();

dog1.name = "jack";

dog1.printname();

}

}

public class pet

{

public string name;

public void printname() { Console.WriteLine("寵物的名字是"+ name); }

}

public class dog : pet

{

}

}


2 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

為啥不能繼承

我要回答 關(guān)注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號