<%@ page Language="c#" runat="server" %>
<script runat="server">
public class Book
{
private string title;
private int isbn;
private decimal price;
public Book()
{
title = "Book";
isbn = 099999999999;
}
public string TitleInfo
{
get
{
return title + " <i>[ISBN: " + isbn + "]</i>";
}
}
public string Title
{
get
{
return title;
}
}
public int Isbn
{
get
{
return isbn;
}
}
public decimal Price
{
get
{
return price;
}
set
{
price = value;
}
}
}
void Page_Load()
{
Book MyBook = new Book();
Response.Write("<b>new book 'MyBook' created.</b>");
MyBook.Price = 39.99m;
Response.Write("<br/>Title info: " + MyBook.TitleInfo);
Response.Write("<br/>Price: $" + MyBook.Price + "<br/>");
}
</script>
|