源码在vs2005中测试可以运行;
源码如下:
using System;
class Card{
private string title, author;
private int total;
public Card()
{
title = "";
author = "";
total = 0;
}
//store函数使用ref关键字用来存储图书信息
public void store(ref Card card)//使用ref关键字进行引用传递{
title = card.title;
author = card.author;
total = card.total;
}
public void show()
{
Console.WriteLine("Title:{0},Author:{1},Total:{2}", title, author, total);
}
public string Title//Title的属性可读可写
{
get
{
return title;
}
set
{
title = value;
}
}
public string Author
{
get
{
return author;
}