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

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么這個年齡調(diào)試不出來

為什么這個年齡調(diào)試不出來

C#
Joker_Yao 2016-05-06 23:55:22
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace learning{? ? class Program? ? {? ? ? ? static void Main(string[] args)? ? ? ? {? ? ? ? ? ? student a = new student();? ? ? ? ? ? a.Birthday=Convert.ToDateTime("2014-1-1");? ? ? ? ? ? a.Name = "小明";? ? ? ? ? ? Console.WriteLine("我的姓名是{0}",a.Name);? ? ? ? ? ? Console.WriteLine("我的性別是{0}", a.Sex);? ? ? ? ? ? Console.WriteLine("我的生日是{0}", a.Birthday);? ? ? ? ? ? Console.WriteLine("我的年齡是{0}", a.Age);? ? ? ? ? ? Console.ReadKey();? ? ? ? }? ? }?class student? ? {? ? ? ? string name;? ? ? ? public string Name? ? ? ? {? ? ? ? ? ? get { return name; }? ? ? ? ? ? set { name = value; }? ? ? ? }? ? ? ? string sex = "男";? ? ? ? public string Sex? ? ? ? {? ? ? ? ? ? get { return sex; }? ? ? ? }? ? ? ? DateTime birthday;? ? ? ? public DateTime Birthday? ? ? ? {? ? ? ? ? ? get { return birthday; }? ? ? ? ? ? set { birthday = value; }? ? ? ? }? ? ? ? int age;? ? ? ? public int Age?? ? ? ? {? ? ? ? ? ? get { return age; }? ? ? ? ? ? set { age = Convert.ToInt32(DateTime.Now.Year - Birthday.Year); }? ? ? ? }? ? }}
查看完整描述

2 回答

已采納
?
pick_J

TA貢獻(xiàn)9條經(jīng)驗 獲得超4個贊

student a = new student();

student 初始化時,Birthday 并沒值

查看完整回答
2 反對 回復(fù) 2016-05-09
?
tanuoy

TA貢獻(xiàn)2條經(jīng)驗 獲得超2個贊

贊同一樓的 。

student a = new student() { Birthday = Convert.ToDateTime("2014-1-1") };

這樣寫 才可以有值 ?

查看完整回答
1 反對 回復(fù) 2016-05-11
  • 2 回答
  • 0 關(guān)注
  • 1504 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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