dynamic_cast: ͨ³£ÔÚ»ùÀàºÍÅÉÉúÀàÖ®¼äת»»Ê±Ê¹ÓÃ,run-time cast
const_cast: Ö÷ÒªÕë¶ÔconstºÍvolatileµÄת»».
static_cast: Ò»°ãµÄת»»£¬no run-time check.ͨ³££¬Èç¹ûÄã²»ÖªµÀ¸ÃÓÃÄĸö£¬¾ÍÓÃÕâ¸ö¡£
reinterpret_cast: ÓÃÓÚ½øÐÐûÓÐÈκιØÁªÖ®¼äµÄת»»£¬±ÈÈçÒ»¸ö×Ö·ûÖ¸Õëת»»ÎªÒ»¸öÕûÐÎÊý¡£
C++µÄËÄÖÖcast²Ù×÷·ûµÄÇø±ð
·¢ÐÅÕ¾: ˮľÉçÇø (Thu Jan 26 21:15:16 2006), Õ¾ÄÚ
ÉùÃ÷ by NetMD£º
²¢·ÇÎÒµÄÔ´´£¬À´×Ô»¥ÁªÍø£¬ÇÒÊÇÁ½ÆªÌû×ӵĺϼ¯£¬¸öÈ˾õµÃÕâÑù²Å±È½ÏÍ걸
----------------------------------------------------------------------
Q:ʲôÊÇC·ç¸ñת»»£¿Ê²Ã´ÊÇstatic_cast, dynamic_cast ÒÔ¼° reinterpret_cast£¿Çø±ðÊÇʲô£¿ÎªÊ²Ã´Òª×¢Ò⣿
A:ת»»µÄº¬ÒåÊÇͨ¹ý¸Ä±äÒ»¸ö±äÁ¿µÄÀàÐÍΪ±ðµÄÀàÐÍ´Ó¶ø¸Ä±ä¸Ã±äÁ¿µÄ±íʾ·½Ê½¡£ÎªÁËÀàÐÍת»»Ò»¸ö¼òµ¥¶ÔÏóΪÁíÒ»¸ö¶ÔÏóÄã»áʹÓô«Í³µÄÀàÐÍת»»²Ù×÷·û¡£±ÈÈ磬ΪÁËת»»Ò»¸öÀàÐÍΪdouboleµÄ¸¡µãÊýµÄÖ¸Õëµ½ÕûÐÍ£º
´úÂë:
int i;
double d;
i = (int) d; ......
Ò»¡¢¿ª·¢»·¾³ÅäÖÃ
µÚÒ»²½£ºÏÂÔØj2sdkºÍtomcat£ºµ½sun¹Ù·½Õ¾£¨http://java.sun.com/j2se/1.5.0/download.jsp
£©ÏÂÔØj2sdk£¬×¢ÒâÏÂÔذ汾ΪWindows Offline InstallationµÄSDK£¬Í¬Ê±×îºÃÏÂÔØJ2SE 1.5.0 Documentation£¬È»ºóµ½tomcat¹Ù·½Õ¾µã£¨http://jakarta.apache.org/site/downloads/downloads_tomcat-5.cgi
£©ÏÂÔØtomcat£¨ÏÂÔØ×îÐÂ5.5.9°æ±¾µÄtomcat£©£»
µÚ¶þ²½£º°²×°ºÍÅäÖÃÄãµÄj2sdkºÍtomcat£ºÖ´ÐÐj2sdkºÍtomcatµÄ°²×°³ÌÐò£¬È»ºó°´Ä¬ÈÏÉèÖýøÐа²×°¼´¿É¡£
1.°²×°j2sdkÒÔºó£¬ÐèÒªÅäÖÃһϻ·¾³±äÁ¿£¬ÔÚÎҵĵçÄÔ->ÊôÐÔ->¸ß¼¶->»·¾³±äÁ¿->ϵͳ±äÁ¿ÖÐÌí¼ÓÒÔÏ»·¾³±äÁ¿(¼Ù¶¨ÄãµÄj2sdk°²×°ÔÚc:\j2sdk1.5.0£©£º
JAVA_HOME=c:\j2sdk1.5.0
classpath=.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;£¨.;Ò»¶¨²»ÄÜÉÙ£¬ÒòΪËü´ú±íµ±Ç°Â·¾¶)
path=%JAVA_HOME%\bin
½Ó×Å¿ÉÒÔдһ¸ö¼òµ¥µÄjava³ÌÐòÀ´²âÊÔJ2SDKÊÇ·ñÒÑ°²×°³É¹¦£º
public class Test{
public static void main(String args[]){
System.out.println("This is a test program.");
}
}
½«ÉÏÃæµÄÕâ¶Î³ÌÐò±£´æΪÎļþÃûΪTest.javaµÄÎļþ¡£
È»ºó´ò¿ªÃüÁîÌáʾ·û´°¿Ú£¬cdµ½Ä ......