Viewing source for recipe1407cs.aspx
<%@ Page Language="cs" %>
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Recipe1407Class CustomClass;
CustomClass = new Recipe1407Class();
Response.Write(String.Format("Recipe1407Class(\"\"), Chapter: {0}, Title: {1}, Subtitle: {2}<br/>", CustomClass.Chapter, CustomClass.Title, CustomClass.SubTitle));
CustomClass = new Recipe1407Class("Multiple Constructors");
Response.Write(String.Format("Recipe1407Class(\"Multiple Constructors\"), Chapter: {0}, Title: {1}, Subtitle: {2}<br/>", CustomClass.Chapter, CustomClass.Title, CustomClass.SubTitle));
CustomClass = new Recipe1407Class("Multiple Constructors", "Two parameters");
Response.Write(String.Format("Recipe1407Class(\"Multiple Constructors\", \"Two parameters\"), Chapter: {0}, Title: {1}, Subtitle: {2}<br/>", CustomClass.Chapter, CustomClass.Title, CustomClass.SubTitle));
}
public class Recipe1407Class
{
private string _Title;
private int _Chapter;
private string _SubTitle;
public Recipe1407Class()
{
_Chapter = 14;
}
public Recipe1407Class(string title) : this()
{
_Title = title;
}
public Recipe1407Class(string title, string subTitle) : this()
{
_Title = title;
_SubTitle = subTitle;
}
public string Title
{
get {
return _Title;
}
set {
_Title = value;
}
}
public string SubTitle
{
get {
return _SubTitle;
}
set {
_SubTitle = value;
}
}
public int Chapter
{
get {
return _Chapter;
}
set {
_Chapter = value;
}
}
}
</script>
<html>
<head>
<title>Creating Multiple Constructors For a Class</title>
</head>
<body>
<form runat="server">
</form>
</body>
</html>