C: ÃæÏò¶ÔÏó(2)
ÑÝʾÈçºÎÓÃCʵÏּ̳У¬ÖØÔØÖ®ÀàµÄÍæÒÕ¶ù¡£VC++6.0±àÒëͨ¹ý¡£
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef class
#define class struct
#endif
#ifndef private
#define private
#endif
#ifndef public
#define public
#endif
#ifndef protected
#define protected
#endif
#ifndef bool
#define bool int
#endif
#ifndef true
#define true 1
#endif
#ifndef false
#define false 0
#endif
class Parent{
//private members
private class Parent *this;
private char *name;
//public members
public void (*construct)(class Parent *this);
public bool (*setName)(class Parent *this, const char *name);
public char* (*getName)(class Parent *this);
public void (*destruct)(class Parent *this);
};
class Son{
//private members
private class Son *this;
//inherit properties from Parent, we use a pointer here to simulate inheritance
private class Parent *inherit;
//add new members
private char* addr;
//public members
public bool (*construct)(class Son *this);
public bool (*setName)(class Son *this, const char *name);
public char* (*getName)(class Son *this);
public bool (*setAddr)(class Son *this, const char *addr);
public char* (*getAddr)(class Son *this);
public void (*destruct)(class Son *this);
};
//foward declaration
//-----Members for Parent begin
void ParentConstruct(class Parent *this);
bool setName(class Parent *this, const char *name);
char *getName(class Parent *this);
void ParentDestruct(class Parent *this);
//-----Mmmbers for Parent end
//----Members for Son begin
bool SonConstruct(clas
Ïà¹ØÎĵµ£º
CºÍC++ÓïÑÔѧϰ×ܽá(Ò»)
֪ʶ½á¹¹:
1¡¢if,for,switch,goto
2¡¢#define,const
3¡¢Îļþ¿½±´µÄ´úÂë,¶¯Ì¬Éú³ÉÄÚ´æ,¸´ºÏ±í´ïʽ,strcpy,memcpy,sizeof
4¡¢º¯Êý²ÎÊý´«µÝ,ÄÚ´æ·ÖÅ䷽ʽ,ÄÚ´æ´íÎó±íÏÖ,mallocÓënewÇø±ð
5¡¢ÀàÖØÔØ¡¢Òþ²ØÓ븲¸ÇÇø±ð,externÎÊÌâ,º¯Êý²ÎÊýµÄȱʡ
ÖµÎÊÌâ,ºê´úÂëÓëÄÚÁªº¯ÊýÇø±ð
6¡¢¹¹ÔìºÍÎö¹ ......
ʹÓà C# 2.0 ÃüÁîÐбàÒëÆ÷
http://msdn.microsoft.com/zh-cn/library/ms379563(vs.80).aspx#mainSection
ÕªÒª£º±¾ÎÄ·ÖÎöÁËʹÓà C# ÃüÁîÐбàÒëÆ÷ csc.exe Éú³ÉÓ¦ÓóÌÐòµÄ¹ý³Ì¡£Í¬Ê±£¬»¹½«Ïò¶ÁÕß½éÉܺܶàΪ C# 2.0 ¶ÀÓеıàÒëÆ÷Ñ¡ÏÀýÈ磬extended/reference ±êÖ¾ºÍÇ¿Ãû³ÆÖ§³Ö¡£ÔĶÁÍê±¾ÎĵÄÄÚÈÝÖ®ºó£¬Äú½«Äܹ»ÇáËɵØÔÚû ......
±³¾°
ÏîÄ¿µÄ
×Ô¶¯»¯²âÊÔÖÐÒѾʹÓÃÁË»ùÓÚPython
½Å±¾µÄ¿ò¼Ü£¬×Ô¶¯»¯¹ý³ÌÖÐ×î¹Ø¼üµÄÎÊÌâ¾ÍÊÇÈçºÎʵÏÖ׮ģ¿é¡£ÔËÓÃ
Python
Ç¿´óµÄ¹¦ÄÜ£¬ÊµÏÖÈκÎ׮ģ¿é¶¼ÊÇ¿ÉÄܵ쬵«ÊÇÊÇ·ñ±ØÐëÍêȫʹÓÃ
Python
ʵÏÖÄ£¿éÂß¼£¬³É±¾ÊÇÒ»¸ö¾ö¶¨ÐÔÒòËØ¡£ÔÚ׮ģ¿éÂß¼¼òµ¥µÄÇé¿öÏ£¬Ê¹ÓÃ
Python
Ä£ÄâÄ£¿éÂß¼²»µ«Ê¹×Ô¶¯»¯²âÊԵĽṹÇå ......