CµÄenum struct ÒÔ¼° JavaµÄenum
ÔÚcÖÐenumµÄʹÓúÍstructºÜÏñ
enum name{
a,b,c
};
struct name{
int a;
int b;
char c;
};
or
typedef struct{
int a;
int b;
char c;
}Name;
ʹÓõÄʱºò¶¼ÒªÏÈÉùÃ÷±äÁ¿
enum name n1,n2,n3;
n1=a;
n2=b;
n3=enum name(3-1);
struct name sn1,sn2;
sn1=(struct name *)malloc(parameter*sizeof(struct name))//ʹÓÃmallocµÄʱºòҪǿÖÆת»»£»
ÔÚjavaÖÐenumµÄʹÓãº
ºÍÀàµÄ¶¨Òå·Ç³£µÄÏàÏñ£¬»òÕßÓгÆΪÊǾ²Ì¬Àࣺ
public enum MyColor{red,yellow,black};
ÔÚʹÓõÄʱºòÒªÏÈnew¶ÔÏó£»
MyColor mc=MyColor.red;//new¶ÔÏó²¢ÇÒ³õʼ»¯£»È»ºó¾Í¿ÉÒÔʹÓÃÕâ¸ö¶ÔÏó£»
public class test{
public enum MyColor{
red;
black;
}
public static void main(String [] args){
MyColor mc= MyColor.red;
switch (mc){
case red:System.out.println("red");break;
case black:System.out.println("black");break;
default:System.out.println("Error");
}
}
}
Ïà¹ØÎĵµ£º
//package ÓéÀÖ;
import java.awt.Container;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.text.DecimalFormat;
import javax.swing ......
ÕâÁ½Ìì,ÒòΪÏîÄ¿ÐèÒª,Éæ¼°µ½Îļþ¼ÐµÄÉÏ´«,ÏëÁ˺ܾÃ,ÔÚÍøÉÏÒ²ÕÒÁËһЩ×ÊÁÏ,¶¼Ã»ÓÐʲôºÜºÃµÄ°ì·¨,¶¼ÊÇÓòå¼þÖ®ÀàµÄ½â¾ö,ºóÃæ¾ÍÏëµ½ÁËÉÏ´«Ñ¹Ëõ
Îļþ,˵µ½Ñ¹ËõÎļþ,×ÔÈ»¾Í»áÓöµ½,ÎļþµÄ½âѹËõÎÊÌâ,´ó¼Ò¶¼ÖªµÀ,±È½Ï³£¼ûµÄѹËõÎļþÓÐrar,zip,È»¶ørar,zipµÄÇø±ðÓÖÔÚÄÄ?˵һ
µã,zip ѹËõËã·¨ÊÇÃâ·Ñ¿ª·ÅµÄ£¬ÈκÎÈË¿ÉÒÔÃâ·ÑʹÓᣵ ......
[C/C++ Digestion] – Rule of Three,
¸´ÖÆ¿ØÖÆ
×÷Õߣº
Jason Lee @
http://blog.csdn.net/jasonblog
ÈÕÆÚ£º
2010-04-13
[1]
¸´Öƹ¹Ô캯Êý
copy constructor
Rule of Three
ÊÇÖ¸ÀàÈç¹ûÐèÒªÎö¹¹º¯Êý£¬Ôòͨ³£Ò²ÐèÒª¸´Öƹ¹Ô캯ÊýºÍ¸³Öµ²Ù×÷·û¡£¶øÆäʵϰ¹ßµØÏÔʾ±àдÕâÈýÕß±¾¾ÍÊÇÒ»¸öÁ¼ºÃµÄÏ°¹ß¡£Òò ......
¼ò½é
¡¡¡¡¶ÔÓںܶà³õѧÕßÀ´Ëµ£¬ÍùÍù¾õµÃ»Øµ÷º¯ÊýºÜÉñÃØ£¬ºÜÏëÖªµÀ»Øµ÷º¯ÊýµÄ¹¤×÷ÔÀí¡£±¾ÎĽ«Òª½âÊÍʲôÊǻص÷º¯Êý¡¢ËüÃÇÓÐʲôºÃ´¦¡¢ÎªÊ²Ã´ÒªÊ¹ÓÃËüÃǵȵÈÎÊÌ⣬ÔÚ¿ªÊ¼Ö®Ç°£¬¼ÙÉèÄãÒѾÊìÖªÁ˺¯ÊýÖ¸Õë¡£
¡¡¡¡Ê²Ã´Êǻص÷º¯Êý£¿
¡¡¡¡¼ò¶øÑÔÖ®£¬»Øµ÷º¯Êý¾ÍÊÇÒ»¸öͨ¹ýº¯ÊýÖ¸Õëµ÷Óõĺ¯Êý¡£Èç¹ûÄã°Ñº¯ÊýµÄÖ¸Õë(µØÖ·)×÷Ϊ²ÎÊý ......
Cר¼Ò±à³Ì ¾«±àÖ®Ò» µÚÒ»ÕÂ~µÚÈýÕÂ
CµÄ¸´ÔÓÖ®´¦ ÔÚÓÚËüµÄÖ¸Õë ,µ«ÊDZÈÆäÖ¸Õë¸üΪ¸´ÔÓµÄÊÇËüµÄÉùÃ÷ !!!
ÄãÄÜ¿´¶®ËüÃǵÄÒâ˼ Âð?
apple=sizeof(int)*p ; apple=sizeof * p;
j= (char (*)[20])malloc(20);
int const * grape; Óë int * const gr ......