本人学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());
}
}
}
}
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。