结构的问题 新手求解疑
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace 练习2
{
class Program
{
static void Main(string[] args)
{
MyClass myclass = new MyClass("赵", "子龙", "", );
myclass.Age=22;
myclass.Sex="男";
string name1=myclass.Name();
Console.WriteLine("我叫{0},性别:{1},年龄:{2}",name1,myclass.Sex,myclass.Age);
Console.ReadKey();
}
struct MyClass
{
private string firstname;
private string secondname;
private int age;
private string sex;
public MyClass(string firstname, string secondname, string sex, int age)
{
this.age = age;
this.sex = sex;
this.firstname = firstname;
this.secondname = secondname;
}
public int Age
{
get { return age; }
set { age = value; }
}
public string Sex
{
get { return sex; }
set { sex = value; }
}
public string Name()
{
&nb