⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 utf-8, unicode, gb2312格式串转换之-c语言版 - 平凡中的不平凡 - 博客园.htm

📁 最为全面的c++内存模型探秘。不管是初学者还是老手
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0060)http://www.cnblogs.com/itech/archive/2009/02/25/1398230.html -->
<HTML><HEAD id=Head><TITLE>[C++对象模型][10]类型转化 - iTech's Blog - 博客园</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META id=metaKeywords content=[Cpp对象模型],C,对象模型,10,类型转化 name=keywords>
<META 
content=一typeid与dynamic_cast1)RTTI,RuntimeTypeIdentification(RTTI)orRun-timetypeinformation(RTTI),表示在运行时动态决定变量的类型,来调用正确的虚函数。RTTI在VS2008中默 
name=description><LINK id=CommondCss 
href="UTF-8, Unicode, GB2312格式串转换之-C语言版 - 平凡中的不平凡 - 博客园.files/common.css" 
type=text/css rel=stylesheet><LINK id=MainCss 
href="UTF-8, Unicode, GB2312格式串转换之-C语言版 - 平凡中的不平凡 - 博客园.files/style.css" 
type=text/css rel=stylesheet><LINK id=CommondCss2 
href="UTF-8, Unicode, GB2312格式串转换之-C语言版 - 平凡中的不平凡 - 博客园.files/common2.css" 
type=text/css rel=stylesheet><LINK id=RSSLink title=RSS 
href="http://www.cnblogs.com/itech/rss" type=application/rss+xml 
rel=alternate><LINK id=RSDLink title=RSD 
href="http://www.cnblogs.com/itech/rsd.xml" type=application/rsd+xml 
rel=EditURI>
<SCRIPT src="UTF-8, Unicode, GB2312格式串转换之-C语言版 - 平凡中的不平凡 - 博客园.files/common.js" 
type=text/javascript></SCRIPT>

<META content="MSHTML 6.00.2900.3492" name=GENERATOR></HEAD>
<BODY>
<FORM id=Form1 name=Form1 onsubmit="javascript:return WebForm_OnSubmit();" 
action=1398230.html method=post>
<DIV><INPUT id=__EVENTTARGET type=hidden name=__EVENTTARGET> <INPUT 
id=__EVENTARGUMENT type=hidden name=__EVENTARGUMENT> <INPUT 
id="&#13;&#10;__VIEWSTATE" type=hidden name=__VIEWSTATE> </DIV>
<SCRIPT type=text/javascript>
//<![CDATA[
var theForm = document.forms['Form1'];
if (!theForm) {
    theForm = document.Form1;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</SCRIPT>

<SCRIPT 
src="UTF-8, Unicode, GB2312格式串转换之-C语言版 - 平凡中的不平凡 - 博客园.files/WebResource.axd" 
type=text/javascript></SCRIPT>

<SCRIPT language=JavaScript>
									function ctlent(evt,id)
											{
												if(evt.ctrlKey && evt.keyCode == 13)
												{	
													try
													{
														TempSave(id);
													}
													catch(ex)
													{
													}
													finally
													{
													    __doPostBack('AjaxHolder$PostComment$btnSubmit','')
													}
												}
		
												}</SCRIPT>

<SCRIPT language=JavaScript>function SetReplyAuhor(author){document.getElementById('AjaxHolder_PostComment_tbComment').value+="@"+author+"\n";document.getElementById('AjaxHolder_PostComment_tbComment').focus();return false}</SCRIPT>

<SCRIPT 
src="UTF-8, Unicode, GB2312格式串转换之-C语言版 - 平凡中的不平凡 - 博客园.files/ScriptResource.axd" 
type=text/javascript></SCRIPT>

<SCRIPT 
src="D:\c++内存模型\UTF-8, Unicode, GB2312格式串转换之-C语言版 - 平凡中的不平凡 - 博客园.files\ScriptResource(1).axd" 
type=text/javascript></SCRIPT>

<SCRIPT 
src="D:\c++内存模型\UTF-8, Unicode, GB2312格式串转换之-C语言版 - 平凡中的不平凡 - 博客园.files\ScriptResource(2).axd" 
type=text/javascript></SCRIPT>

<SCRIPT src="UTF-8, Unicode, GB2312格式串转换之-C语言版 - 平凡中的不平凡 - 博客园.files/js" 
type=text/javascript></SCRIPT>

<SCRIPT type=text/javascript>
//<![CDATA[
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
//]]>
</SCRIPT>
<!--done-->
<DIV id=home>
<DIV id=header>
<DIV id=blogTitle><A id=lnkBlogLogo href="http://www.cnblogs.com/itech/"><IMG 
id=blogLogo alt=返回主页 
src="UTF-8, Unicode, GB2312格式串转换之-C语言版 - 平凡中的不平凡 - 博客园.files/logo.png"></A> <!--done-->
<H1><A class=headermaintitle id=Header1_HeaderTitle 
href="http://www.cnblogs.com/itech/">iTech's Blog</A></H1>
<H2>编程语言(C++,C++/CLI,C#&amp;Python)架构设计(Design 
pattern&amp;Architecture)系统内核(Windows&amp;Linux)!<A 
href="http://www.cnblogs.com/itech/articles/1363498.html"><IMG 
src="UTF-8, Unicode, GB2312格式串转换之-C语言版 - 平凡中的不平凡 - 博客园.files/o_icon_sub_c1s17.gif"></A> 
</H2></DIV><!--end: blogTitle 博客的标题和副标题 -->
<DIV style="DISPLAY: none"><IMG 
src="UTF-8, Unicode, GB2312格式串转换之-C语言版 - 平凡中的不平凡 - 博客园.files/body.gif"></DIV>
<DIV id=navigator><!--done-->
<UL id=navList>
  <LI><A class=menu id=MyLinks1_HomeLink href="http://www.cnblogs.com/">博客园</A> 
  </LI>
  <LI><A class=menu id=MyLinks1_SpaceLink 
  href="http://space.cnblogs.com/">社区</A> </LI>
  <LI><A class=menu id=MyLinks1_MyHomeLink 
  href="http://www.cnblogs.com/itech/">首页</A> </LI>
  <LI><A class=menu id=MyLinks1_NewPostLink 
  href="http://www.cnblogs.com/itech/admin/EditPosts.aspx?opt=1">新随笔</A> </LI>
  <LI><A class=menu id=MyLinks1_ContactLink accessKey=9 
  href="http://www.cnblogs.com/itech/contact.aspx?id=1">联系</A> </LI>
  <LI><A class=menu id=MyLinks1_Admin 
  href="http://www.cnblogs.com/itech/admin/EditPosts.aspx">管理</A> </LI>
  <LI><A class=menu id=MyLinks1_Syndication 
  href="http://www.cnblogs.com/itech/rss">订阅</A> <A class=aHeaderXML 
  id=MyLinks1_XMLLink href="http://www.cnblogs.com/itech/rss"><IMG 
  style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" 
  alt=订阅 
  src="UTF-8, Unicode, GB2312格式串转换之-C语言版 - 平凡中的不平凡 - 博客园.files/rss.gif"></A> 
  </LI></UL>
<DIV class=blogStats><!--done-->随笔- 17&nbsp; 文章- 14&nbsp; 评论- 5&nbsp; </DIV><!--end: blogStats --></DIV><!--end: navigator 博客导航栏 --></DIV><!--end: header 头部 -->
<DIV id=main>
<DIV id=topicList>
<DIV class=forFlow>
<SCRIPT type=text/javascript>
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('AjaxHolder$scriptmanager1', document.getElementById('Form1'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tAjaxHolder$UpdatePanel1'], [], [], 90);
//]]>
</SCRIPT>
<!--done-->
<DIV id=topics>
<DIV class=post>
<H1 class=postTitle><A class=postTitle2 id=AjaxHolder_ctl01_TitleUrl 
href="http://www.cnblogs.com/itech/archive/2009/03/01/1398230.html">[C++对象模型][10]类型转化</A> 
</H1>
<DIV class=clear></DIV>
<DIV class=postBody>
<P>&nbsp;</P>
<P>一 typeid与dynamic_cast</P>
<P>1)RTTI, Runtime Type Identification (RTTI) or Run-time type information 
(RTTI),表示在运行时动态决定变量的类型,来调用正确的虚函数。 RTTI在VS2008中默认为关闭,可以通过修改编译选项Enable Run-Time 
Type Info 为 Yes,来启用RTTI,只有当启动RTTI时,用来RTTI功能的typeid和dynamic_cast才能正常工作。</P>
<P>2)type_info,用来描述类型信息。type_info存储了它所描述的类型的名字。RTTI就是使用type_info来实现的。type_info的定义如下:</P>
<DIV class=cnblogs_code><IMG id=Code_Closed_Image_135619 style="DISPLAY: none" 
onclick="this.style.display='none'; document.getElementById('Code_Closed_Text_135619').style.display='none'; document.getElementById('Code_Open_Image_135619').style.display='inline'; document.getElementById('Code_Open_Text_135619').style.display='inline';" 
height=16 
src="UTF-8, Unicode, GB2312格式串转换之-C语言版 - 平凡中的不平凡 - 博客园.files/ContractedBlock.gif" 
width=11 align=top><IMG id=Code_Open_Image_135619 
onclick="this.style.display='none'; document.getElementById('Code_Open_Text_135619').style.display='none'; getElementById('Code_Closed_Image_135619').style.display='inline'; getElementById('Code_Closed_Text_135619').style.display='inline';" 
height=16 
src="UTF-8, Unicode, GB2312格式串转换之-C语言版 - 平凡中的不平凡 - 博客园.files/ExpandedBlockStart.gif" 
width=11 align=top><SPAN class=cnblogs_code_Collapse 
id=Code_Closed_Text_135619>Code</SPAN><SPAN id=Code_Open_Text_135619><BR><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><SPAN 
style="COLOR: #0000ff">class</SPAN><SPAN 
style="COLOR: #000000">&nbsp;type_info&nbsp;{<BR></SPAN><SPAN 
style="COLOR: #0000ff">public</SPAN><SPAN 
style="COLOR: #000000">:<BR>&nbsp;&nbsp;</SPAN><SPAN 
style="COLOR: #0000ff">virtual</SPAN><SPAN 
style="COLOR: #000000">&nbsp;</SPAN><SPAN style="COLOR: #000000">~</SPAN><SPAN 
style="COLOR: #000000">type_info();<BR>&nbsp;&nbsp;</SPAN><SPAN 
style="COLOR: #0000ff">bool</SPAN><SPAN 
style="COLOR: #000000">&nbsp;</SPAN><SPAN 
style="COLOR: #0000ff">operator</SPAN><SPAN 
style="COLOR: #000000">==</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN 
style="COLOR: #0000ff">const</SPAN><SPAN 
style="COLOR: #000000">&nbsp;type_info</SPAN><SPAN 
style="COLOR: #000000">&amp;</SPAN><SPAN 
style="COLOR: #000000">&nbsp;rhs)&nbsp;</SPAN><SPAN 
style="COLOR: #0000ff">const</SPAN><SPAN 
style="COLOR: #000000">;<BR>&nbsp;&nbsp;</SPAN><SPAN 
style="COLOR: #0000ff">bool</SPAN><SPAN 
style="COLOR: #000000">&nbsp;</SPAN><SPAN 
style="COLOR: #0000ff">operator</SPAN><SPAN 
style="COLOR: #000000">!=</SPAN><SPAN style="COLOR: #000000">&nbsp;(</SPAN><SPAN 
style="COLOR: #0000ff">const</SPAN><SPAN 
style="COLOR: #000000">&nbsp;type_info</SPAN><SPAN 
style="COLOR: #000000">&amp;</SPAN><SPAN 
style="COLOR: #000000">&nbsp;rhs)&nbsp;</SPAN><SPAN 
style="COLOR: #0000ff">const</SPAN><SPAN 
style="COLOR: #000000">;<BR>&nbsp;&nbsp;</SPAN><SPAN 
style="COLOR: #0000ff">bool</SPAN><SPAN 
style="COLOR: #000000">&nbsp;before&nbsp;(</SPAN><SPAN 
style="COLOR: #0000ff">const</SPAN><SPAN 
style="COLOR: #000000">&nbsp;type_info</SPAN><SPAN 
style="COLOR: #000000">&amp;</SPAN><SPAN 
style="COLOR: #000000">&nbsp;rhs)&nbsp;</SPAN><SPAN 
style="COLOR: #0000ff">const</SPAN><SPAN 
style="COLOR: #000000">;<BR>&nbsp;&nbsp;</SPAN><SPAN 
style="COLOR: #0000ff">const</SPAN><SPAN 
style="COLOR: #000000">&nbsp;</SPAN><SPAN 
style="COLOR: #0000ff">char</SPAN><SPAN style="COLOR: #000000">*</SPAN><SPAN 
style="COLOR: #000000">&nbsp;name()&nbsp;</SPAN><SPAN 
style="COLOR: #0000ff">const</SPAN><SPAN 
style="COLOR: #000000">;<BR></SPAN><SPAN 
style="COLOR: #0000ff">private</SPAN><SPAN 
style="COLOR: #000000">:<BR>&nbsp;&nbsp;type_info&nbsp;(</SPAN><SPAN 
style="COLOR: #0000ff">const</SPAN><SPAN 
style="COLOR: #000000">&nbsp;type_info</SPAN><SPAN 
style="COLOR: #000000">&amp;</SPAN><SPAN 
style="COLOR: #000000">&nbsp;rhs);<BR>&nbsp;&nbsp;type_info</SPAN><SPAN 
style="COLOR: #000000">&amp;</SPAN><SPAN 
style="COLOR: #000000">&nbsp;</SPAN><SPAN 
style="COLOR: #0000ff">operator</SPAN><SPAN style="COLOR: #000000">=</SPAN><SPAN 
style="COLOR: #000000">&nbsp;(</SPAN><SPAN 
style="COLOR: #0000ff">const</SPAN><SPAN 
style="COLOR: #000000">&nbsp;type_info</SPAN><SPAN 
style="COLOR: #000000">&amp;</SPAN><SPAN 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -