JavaÓëC++µÄ¶à̬
ûÓбØÒªÓÃÒ»¶ÑÈÆ¿ÚµÄÐÎÈÝ´ÊÀ´ÃèÊöʲô½Ð¶à̬£¬Ö»¾Ù³ö¼¸¸ö¹Ø¼üµã¡£
É裺gunΪ¸¸À࣬shootgunºÍpistolΪgunµÄ×ÓÀà¡£
Java:
class gun {
void shoot() {
System.out.println("gun shoot");
}
}
class shootgun extends gun {
void shoot() {
System.out.println("shootgun shoot");
}
}
class pistol extends gun {
void shoot() {
System.out.println("pistol shoot");
}
}
C++:
class gun
{
void shoot()
{
cout << "gun shoot" << endl;
}
};
class shootgun : gun
{
void shoot()
{
cout << "shootgun shoot" << endl;
}
};
class pistol : gun
{
void shoot()
{
cout << "pistol shoot" << endl;
&n
Ïà¹ØÎĵµ£º
C/C++º¯Êýµ÷ÓÃÔ¼¶¨ºÍº¯ÊýÃû³ÆÐÞÊιæÔò̽ÌÖ
×÷ÕߣºÐǹ죨oRbIt£©
ʹÓÃC/C++ÓïÑÔ¿ª·¢Èí¼þµÄ³ÌÐòÔ±¾³£Åöµ½ÕâÑùµÄÎÊÌ⣺ÓÐʱºòÊdzÌÐò±àÒëûÓÐÎÊÌ⣬µ«ÊÇÁ´½ÓµÄʱºò×ÜÊDZ¨¸æº¯Êý²»´æÔÚ£¨¾µäµÄLNK
2001´íÎ󣩣¬ÓÐʱºòÊdzÌÐò±àÒëºÍÁ´½Ó¶¼Ã»ÓдíÎ󣬵«ÊÇÖ»Òªµ÷ÓÿâÖеĺ¯Êý¾Í»á³öÏÖ¶ÑÕ»Òì³£¡£ÕâЩÏÖÏóͨ³£ÊdzöÏÖÔÚCºÍC ......
http://www.javaworld.com/javaworld/javaqa/2000-05/03-qa-0526-pass.html
Does Java pass by reference or pass by value?
Why can't you swap in Java?
By Tony
Sintes, JavaWorld.com, 05/26/00
Print
Email
Feedback
Resources
Discuss
(76)
Digg
Reddit
SlashDot
Stumble
......
public static void CentreWnd(Shell shell){
int width = shell.getMonitor().getClientArea().width;
int height = shell.getMonitor().getClientArea().height;
int x = shell.getSize().x;
int y = shell.getSize().y;
if (x > width) {
shell.getSize().x = width;
}
if (y > height) ......
JavaÊÇÈçºÎ¹ÜÀíÄÚ´æ
ΪÁËÅжÏJavaÖÐÊÇ·ñÓÐÄÚ´æÐ¹Â¶£¬ÎÒÃÇÊ×ÏȱØÐëÁ˽âJavaÊÇÈçºÎ¹ÜÀíÄÚ´æµÄ¡£JavaµÄÄÚ´æ¹ÜÀí¾ÍÊǶÔÏóµÄ·ÖÅäºÍÊÍ·ÅÎÊÌâ¡£ÔÚJavaÖУ¬³ÌÐòÔ±ÐèҪͨ¹ý¹Ø¼ü×ÖnewΪÿ¸ö¶ÔÏóÉêÇëÄÚ´æ¿Õ¼ä (»ù±¾ÀàÐͳýÍâ)£¬ËùÓеĶÔÏó¶¼ÔÚ¶Ñ (Heap)ÖзÖÅä¿Õ¼ä¡£ÁíÍ⣬¶ÔÏóµÄÊÍ·ÅÊÇÓÉGC¾ö¶¨ºÍÖ´Ðеġ£ÔÚJavaÖУ¬ÄÚ´æµÄ·ÖÅäÊ ......