富贵资源网 Design By www.hznty.com

本人学Asp.Net不久,用的是C#写代码,在学习C#中发现很多初学者对继承和多态性不是特别的了解,因此作了这个例子,希望对您有所帮助,例子很简单

页面文件TestProfileClass2.aspx
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="gb2312" Src="profile2.cs" %>
<%@ Import Namespace="shai" %>
<html>
<head>
<style>
div"c#" runat="server">
public void Page_Load(Object sender,EventArgs e)
"<u>Profile Class</u><br>";
  message.InnerHtml += "Firstname:"+profile.getFirstname()+"<br>";
  message.InnerHtml += "Lastname:"+profile.getLastname()+"<br>";
  message.InnerHtml += "Phone:"+profile.getPhonenumber()+"<br><br>";

  profile.save();

  ExtendedProfile extendedprofile = new ExtendedProfile();
  message.InnerHtml += "<u>ExtendedProfile Class</u></br>";
  message.InnerHtml += "Firstname:"+profile.getFirstname()+"<br>";
  message.InnerHtml += "Lastname:"+profile.getLastname()+"<br>";
  message.InnerHtml += "Phone:"+extendedprofile.getPhonenumber()+"<br>";
  message.InnerHtml += "Address1:"+extendedprofile.getAddress1()+"<br>";
  message.InnerHtml += "Address2:"+extendedprofile.getAddress2()+"<br>";
  message.InnerHtml += "City:"+extendedprofile.getCity()+"<br>";
  message.InnerHtml += "State:"+extendedprofile.getState()+"<br>";
  message.InnerHtml += "Postal:"+extendedprofile.getPostal()+"<br>";
  message.InnerHtml += "Description:"+extendedprofile.getDescription()+"<br>";

  extendedprofile.save();
"Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>
<body style="font:Arial, Helvetica, sans-serif ">
<b><h3>简单的继承/多态例子</h3></b><br><br>
object output:<br>
<br>
<div id="message" runat="server" />
</body>
</html>


类定义文件profile2.cs
using System;
using System.IO;
using System.Xml;
namespace shai     //名称空间shai
"Saidy";
   _lastname = "Chen";
   _phonenumber = "(010)88716990";
 "D:\\myweb2\\profile2.txt",FileMode.Create,FileAccess.Write);
   StreamWriter sw = new StreamWriter(fs);
   sw.WriteLine("Firstname:"+_firstname.ToString());
   sw.WriteLine("Lastname:"+_lastname.ToString());
   sw.WriteLine("Phone:"+_phonenumber.ToString());
   sw.Flush();
   sw.Close();
   fs.Close();
  "清华大学";
   _address2 = "清华大学物理实验室";
   _city = "北京";
   _state = "北京";
   _postal = "100024";
   _description = "教授";
 "d:\\myweb2\\saidy.xml";
   XmlTextWriter writer = null;           //保存为一个Xml文件
   try
   "Profile",null,null,null);            //表示<!DOCTYPE Profile>
    writer.WriteStartElement("Profile");                         //生成根元素  
    writer.WriteElementString("firstname",_firstname);   //生成子元素  <firstname>_firstname</firstname>
    writer.WriteElementString("lastname",_lastname);
    writer.WriteElementString("phonenumber",_phonenumber);
    writer.WriteElementString("address1",_address1);
    writer.WriteElementString("address2",_address2);
    writer.WriteElementString("city",_city);
    writer.WriteElementString("state",_state);
    writer.WriteElementString("postal",_postal);
  writer.WriteEndElement();
  writer.Flush();
  writer.Close();
   "Exception:",ee.ToString());
   }
 }
}
}

富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com

稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!

昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。

这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。

而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?