Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C++ºÍJavaµÄ¶à¼Ì³Ð


¶à¼Ì³Ð£º
C++ÖеÄÀà¿ÉÒÔÖ±½ÓʵÏÖ¶à¼Ì³Ð È磺class D:public A,public B,public C{……};
JavaÖв»ÄÜÖ±½ÓʵÏÖÕâÑùµÄ¶à¼Ì³Ð£¬µ«ÊÇ¿ÉÒÔÓýӿڣ¨interface£©À´¼ä½ÓʵÏÖ È磺
public class A{ ……}
public interface C{
¡¡¡¡public void c1();
¡¡¡¡public void c2();
}
public class C extends A implements B{
¡¡¡¡//ÈôAÖÐÓй¹Ô캯ÊýÔòÔÚ×ÓÀàÖбØÐëÊÖ¶¯µ÷Óù¹Ô캯Êý  super(<²ÎÊý>);
¡¡¡¡//±ØÐëÖØд½Ó¿ÚBµÄËùÓз½·¨
        public void c1(){ // ʵÏÖ½Ó¿Ú }
        public void c2(){ //ʵÏÖ½Ó¿Ú }
¡¡¡¡……
}
´ÓÉÏÃæµÄ´úÂëÎÒÃÇ»¹¿ÉÒÔ·¢ÏÖÒ»¸öϸ½Ú£ºC++ÖÐÀàµÄ¶¨Òå±ØÐëÔÚÀàÌåµÄ´óÀ¨ºÅºó¼ÓÉÏÒ»¸ö·ÖºÅ£¨;£©µ«ÊÇJavaÖÐûÓÐÕâÑùµÄÒªÇó¡£
ÔÚc++µÄ¶à¼Ì³ÐÖУ¬Òª×¢ÒâÕâÑùÒ»¸öÎÊÌ⣺»ùÀàA£¬×ÓÀàB¡¢C¼Ì³Ð»ùÀàA£¬×ÓÀàDͬʱ¼Ì³Ð×ÔBºÍC£¬´úÂëÈçÏ£º
#include<iostream>
using namespace std;
class A{
 public:
int iVarA;
};
class B:public A{ //¼Ì³Ð
public:
 int iVarB;
};
class C:public A{
public:
int iVarC;
};
class D:public B,public C{
public:
int iVarD;
};
int main(){
D Dtemp;
Dtemp.iVarA = 10; //×¢ÒâÕâÀï²úÉúÁËÆçÒå VC6.0±¨´í£ºerror C2385: 'D::iVarA' is ambiguous(ÆçÒåµÄ)
return 0 ;
}
²úÉúÉÏÃæµÄÆçÒåÊÇÓÉÓÚÔÚDtempÖбäÁ¿iVarAµÄÒýÓÃÊÇÆçÒåµÄ¡£ÕâÖÖÆçÒåÐÔÊÇÓÉÓÚDͨ¹ýÀàB¼Ì³ÐÁËiVarAµÄÒ»·Ý¿½±´£¬ÓÖͨ¹ýC¼Ì³ÐÁËiVarAµÄÒ»·Ý¿½±´¡£
½â¾öÕâ¸öÎÊÌâ¿ÉÒÔÓÐÁ½ÖÖ·½·¨£¬ÆäһʹÓÃ×÷ÓÃÓò·Ö½âÔËËã·û£º
int main(){
D Dtemp;
Dtemp.B::iVarA = 10;
Dtemp.C::iVarA = 10;
return 0;
}
ÄÇôÁíÒ»ÖÖ·½·¨¾ÍÊÇʹÓÃÐé»ùÀ࣬Ïê¼ûÏÂһƪ..


Ïà¹ØÎĵµ£º

תÔØ:Hadoop Ó¦¸ÃÓÃC++ʵÏÖ£¬¶ø²»ÊÇJava

http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html
Sunday, May 10, 2009
Hadoop should target C++/LLVM, not Java (because of watts)
< type="text/javascript">
digg_url="http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html";
Over the years, ......

JAVAÖеÄÔËËã·û

£¨
1
£©
+=
:sum += 1;
Ï൱ÓÚ
sum = sum + 1;
£¨
2
£©
++ --
:i++ i
¼Ó
1, i-- i
¼õ
1, ++
»ò

·ÅÔÚÊýÖµºó£¬±íʾִÐÐÔËËãºó¼Ó£¨¼õ£©
1
£¬·´ÕýÊýֵǰ±íʾִÐÐÔËËãÇ°¼Ó£¨¼õ£©
1
£¨
3
£©

: :
int n = a<10?1:2
±íʾÈç¹û
a
СÓÚ
10
Ôò
n
µÈÓÚ
1
·ñÔòµÈÓÚ
2
£¨
4
......

Java Swing JEditorPane

JEditorPaneÌṩÈýÖÖÀàÐ͵ÄÎı¾ÏÔʾ£¬text/plain,text/html,text/rtf.
JEditorPaneµÄ¼òµ¥Ó÷¨DEMOÈçÏ£º
package ibees.swing;
import java.awt.Toolkit;
import java.io.IOException;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.event.Hype ......

ubuntu9.10ÅäÖÃjava»·¾³

ÔÚ9.10ÖпÉÒÔÔÚÖÕ¶ËÖÐʹÓÃapt-getÃüÁî½øÐа²×°¡£ÕâÖÖ·½·¨±È½Ï¼òµ¥¡£²»¹ý¸öÈËÈÏΪ ¶ÔÓÚ³õѧÕߣ¬»¹ÊÇÊÖ¶¯°²×°±È½ÏºÃ£¬¿ÉÒÔÊìϤºÜ¶à¶«Î÷¡£
1.ÏÂÔØjdkºÍjre
µÇ¼sunÍøÕ¾http://java.sun.com/javase/downloads/index.jsp£¬ÏÂÔØjdk-6u18-linux-i586.binºÍjre-6u18-linux-i586.bin¡£×¢ÒâÔÚ¹ÙÍøÖÐ
ÓÐÁ½¸öÏÂÔصØÖ·£¬Ò»¸öÊÇjdk-6u1 ......

JavaÊý¾Ý±¨±à³ÌÖ®×é²¥

ת×ÔÆäËûÍøÕ¾
ºËÐÄÌáʾ£ºÔÚÐÅϢʱ´ú£¬ÍøÂç¼¼ÊõÓ¦ÓÃÒѾ­ºÜÆÕͨ¡£ÆäÖкܶàÓ¦Óö¼ÒÀÀµÓÚ´ÓÒ»¸öÖ÷»úÏò¶à¸öÖ÷»ú»òÕß´Ó¶à¸öÖ÷»úÏò¶à¸öÖ÷»ú·¢ËÍͬһÐÅÏ¢µÄÄÜÁ¦£¬ÔÚInternet
ÉÏ·Ö·¢µÄÊýÄ¿¿ÉÄÜ´ïÊýÊ®Íǫ̀£¬ÕâЩ¶¼ÐèÒª¸ü¸ßµÄ´ø¿í£¬²¢ÇÒ´ó´ó³¬³öÁ˵¥²¥µÄÄÜÁ¦¡£Ò»ÖÖÄÜ×î´óÏ޶ȵØÀûÓÃÏÖÓдø¿íµÄÖØ
ÔÚÐÅϢʱ´ú£¬ÍøÂç¼¼ÊõÓ¦ÓÃÒѾ­ºÜÆÕÍ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ