﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-凡夫佳佳的瞎说-文章分类-资源共享</title><link>http://www.cppblog.com/jiajiahello/category/9359.html</link><description>佳佳编程记</description><language>zh-cn</language><lastBuildDate>Thu, 29 Dec 2011 19:54:43 GMT</lastBuildDate><pubDate>Thu, 29 Dec 2011 19:54:43 GMT</pubDate><ttl>60</ttl><item><title>【佳佳编程记】-&gt;10.system("pause") 和getchar()有什么区别呢 ？ C++ 心随我向 </title><link>http://www.cppblog.com/jiajiahello/articles/71932.html</link><dc:creator>天天向上</dc:creator><author>天天向上</author><pubDate>Tue, 13 Jan 2009 12:20:00 GMT</pubDate><guid>http://www.cppblog.com/jiajiahello/articles/71932.html</guid><wfw:comment>http://www.cppblog.com/jiajiahello/comments/71932.html</wfw:comment><comments>http://www.cppblog.com/jiajiahello/articles/71932.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/jiajiahello/comments/commentRss/71932.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/jiajiahello/services/trackbacks/71932.html</trackback:ping><description><![CDATA[<p><font color=#660099 size=4>system("pause") 和getchar()有什么区别呢 ？ <br><br>system("pause") 是调用WINDOWS CONSOLE APP下的命令 PAUSE的。 <br>system("const char*")就是调用WINDOWS CONSOLE APP下的命令。 <br>比如system("exit"); <br>system("ping 192.168.0.1")等等 <br><br>而getchar()只是C标准库里等待一个字符的函数，两者区别很大。 <br><br>/*---------------------------------------------------*/ <br>如何使system("pause") 不弹出&#8220;按任意键继续&#8221;这几个字呢？ <br>用system("pause&gt;nul"):就可以了</font><wbr></p>
  <img src ="http://www.cppblog.com/jiajiahello/aggbug/71932.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/jiajiahello/" target="_blank">天天向上</a> 2009-01-13 20:20 <a href="http://www.cppblog.com/jiajiahello/articles/71932.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【佳佳编程记】-&gt;08.C#与VC++联编问题   心随我向  C++</title><link>http://www.cppblog.com/jiajiahello/articles/71929.html</link><dc:creator>天天向上</dc:creator><author>天天向上</author><pubDate>Tue, 13 Jan 2009 12:17:00 GMT</pubDate><guid>http://www.cppblog.com/jiajiahello/articles/71929.html</guid><wfw:comment>http://www.cppblog.com/jiajiahello/comments/71929.html</wfw:comment><comments>http://www.cppblog.com/jiajiahello/articles/71929.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/jiajiahello/comments/commentRss/71929.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/jiajiahello/services/trackbacks/71929.html</trackback:ping><description><![CDATA[<div id=blogDetailDiv style="FONT-SIZE: 16px"><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//联编是指一个电脑程式自身彼此关联的过程。按照联编所进行的阶段不同，可分为两种不同的联编方法：静态联编和动态联编。 </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//静态联编 </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//静态联编是指联编工作出现在编译连接阶段，这种联编又称早期联编，因为这种联编过程是在程式开始运行之前完成的。 </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//在编译时所进行的这种联编又称静态束定。在编译时就解决了程式中的操作调用和执行该操作代码间的关系，确定这种关系又称为束定， </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//在编译时束定又称静态束定。下面举一个静态联编的例子。 </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>#include &lt;cstdlib&gt; </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>#include &lt;iostream&gt; </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>using namespace std; </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>class Point{ </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>private: </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double x,y;&nbsp;&nbsp;&nbsp;&nbsp; </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>public: </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Point(double i,double j){x=i;y=j;} </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double Area() const {return 0.0;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>}; </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>class Rectangle:public Point{ </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>private: </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>double w,h;&nbsp;&nbsp; </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>public: </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>Rectangle(double i,double j,double k,double l):Point(i,j){ </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>&nbsp;&nbsp;w=k; </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>&nbsp;&nbsp;h=l; </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>} </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>double Area() const {return w*h;} </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>}; </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>void fun(Point &amp;s){ </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>&nbsp;&nbsp; cout&lt;&lt;s.Area()&lt;&lt;endl; </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>} </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>int main(int argc, char *argv[]) </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>{ </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>&nbsp;&nbsp;&nbsp;&nbsp;Rectangle rec(3.0,5.2,15.0,25.0); </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>&nbsp;&nbsp;&nbsp;&nbsp;fun(rec); </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>&nbsp;&nbsp;&nbsp;&nbsp;system("PAUSE"); </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>system("PAUSE"); </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>system("PAUSE"); </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>system("PAUSE"); </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>system("PAUSE"); </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>system("PAUSE"); </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>getchar(); </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>&nbsp;&nbsp;&nbsp;&nbsp;return EXIT_SUCCESS; </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>} </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//该程式的运行结果为：0 </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//输出结果表明在fun()函数中，s所引用的对象执行的Area()操作被关联到Point::Area()的实现代码上。 </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//这是因为静态联编的结果。在程式编译阶段，对s所引用的对象所执行的Area()操作只能束定到Point类的函数上。 </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//因此，导致程式输出了所不期望的结果。因为我们期望的是s引用的对象所执行的Area()操作应该束定到Rectangl类的Area()函数上。 </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//这是静态联编所达不到的。 </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//【动态联编】 </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//从对静态联编的上述分析中能够知道，编译程式在编译阶段并不能确切知道将要调用的函数，只有在程式执行时才能确定将要调用的函数， </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//为此要确切知道该调用的函数，需要联编工作要在程式运行时进行，这种在程式运行时进行联编工作被称为动态联编，或称动态束定， </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//又叫晚期联编。 </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//动态联编实际上是进行动态识别。在上例中，前面分析过了静态联编时，fun()函数中s所引用的对象被束定到Point类上。 </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//而在运行时进行动态联编将把s的对象引用束定到Rectangle类上。可见，同一个对象引用s，在不同阶段被束定的类对象将是不同的。 </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//那么如何来确定是静态联编还是动态联编呢？C 规定动态联编是在虚函数的支持下实现的。 </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//从上述分析能够看出静态联编和动态联编也都是属于多态性的，他们是不同阶段对不同实现进行不同的选择。上例中， </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//实际上是对fun()函数参数的多态性的选择。该函数的参数是个类的对象引用，静态联编和动态联编和动态联编实际上 </font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099>//是在选择他的静态类型和动态类型。联编是对这个引用的多态性的选择。 </font><wbr></div>
 <img src ="http://www.cppblog.com/jiajiahello/aggbug/71929.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/jiajiahello/" target="_blank">天天向上</a> 2009-01-13 20:17 <a href="http://www.cppblog.com/jiajiahello/articles/71929.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>【佳佳编程记】-&gt;04.动态联编的定义与调用 C++</title><link>http://www.cppblog.com/jiajiahello/articles/71925.html</link><dc:creator>天天向上</dc:creator><author>天天向上</author><pubDate>Tue, 13 Jan 2009 12:03:00 GMT</pubDate><guid>http://www.cppblog.com/jiajiahello/articles/71925.html</guid><wfw:comment>http://www.cppblog.com/jiajiahello/comments/71925.html</wfw:comment><comments>http://www.cppblog.com/jiajiahello/articles/71925.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/jiajiahello/comments/commentRss/71925.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/jiajiahello/services/trackbacks/71925.html</trackback:ping><description><![CDATA[<font color=#660099 size=4>一.定义： <br><wbr><br></font><font style="LINE-HEIGHT: 1.5em" face="" color=#660099 size=4>　　编译程序在编译阶段并不能确切知道将要调用的函数，只有在程序执行时才能确定将要调用的函数，为此要确切知道该调用的函数，要求联编工作要在程序运行时进行，这种在程序运行时进行联编工作被称为动态联编。 <br></font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099 size=4>　　动态联编必须包括以下方面： <br></font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099 size=4>　　成员函数必须声明为virtual <br></font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099 size=4>　　如果基类中声明了为虚函数，则派生类中不必再声明。 <br></font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099 size=4>二.调用方式： <br></font><wbr><br><font style="LINE-HEIGHT: 1.5em" face="" color=#660099 size=4>　　通过对象的指针或引用调用成员函数；或通过成员函数调用。</font><wbr> 
  <img src ="http://www.cppblog.com/jiajiahello/aggbug/71925.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/jiajiahello/" target="_blank">天天向上</a> 2009-01-13 20:03 <a href="http://www.cppblog.com/jiajiahello/articles/71925.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>