CµÄº¯ÊýÖ¸ÕëʵÏÖC++µÄ¶à̬
CµÄº¯ÊýÖ¸ÕëºÜÇ¿´ó£¬ÓúÃÁ˲ÅÊÇCÓïÑԵĸßÊÖ¡£ÏñGtkÖеĻص÷º¯ÊýµÄʹÓ㬶¼ÌåÏÖÁ˺¯ÊýÖ¸ÕëµÄÇ¿´óÍþÁ¦¡£
struct Point{
int x, y;
};
/*Shape*/
/*----------------------------------------------------------------*/
struct Shape {
struct Methods* methods;
};
struct Methods {//½«C++¶ÔÓ¦ÀàÖÐËùÓгÉÔ±º¯Êý·â×°µ½Ò»¸ö½á¹¹ÌåÀïÃæ
float (*getCircle)(Shape * shape);
float (*getArea)(Shape * shape);
void (*draw)(Shape * shape);
void (*move)(Shape * shape);
};
////////////////C++ Counterpart of above code//////////////////
class Shape {
public:
virtual float getCircle() = 0;
virtual float getArea() = 0;
virtual void draw() = 0;
virtual void move() = 0;
};
///////////////////////////////////////////////////////////////
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/*Rectangle*/
struct Rectangle {
struct Methods * methods; //°üº¬·â×°ºóµÄ³ÉÔ±º¯Êý½á¹¹ÌåµÄÖ¸Õë
Point leftTop; //ShapeÖ®ÍâÅÉÉúµÄ³ÉÔ±±äÁ¿
Point rightBottom; //ShapeÖ®ÍâÅÉÉúµÄ³ÉÔ±±äÁ¿
};
float Rectangle_getCircle(Shape * shape)
{
Rectangle * r = (Rectangle *) shape;
return (r->rightBottom.x - r->leftTop.x +
r->rightBottom.y - r->leftTop.y) * 2;
}
float Rectangle_getArea(Shape * shape){}
void Rectangle_draw (Shape * shape){}
void Rectangle_move(Shape * shape){}
struct Methods rectangleMethods = {
&Rectangle_getCircle,
&Rectangle_getArea,
&Rectangle_draw,
&Rectangle_move,
};
////////////////C++ Counterpart of above code//////////////////
class Rectangle : public Shape {
Point leftTop;
Point rightBottom;
public:
virtual float getCircle();
virtual float
Ïà¹ØÎĵµ£º
Precedence Operator Description Example Overloadable Associativity
1
::
Scope resolution operator
Class::age = 2;
no
none
2
()
()
[]
->
.
++
--
const_cast
dynamic_cast
static_cast
reinterpret_cast
typeid
Function call
Member initalization
Array access
Member access from ......
1.
ÔËÐÐʱ¿âµÄ·¾¶
Ö¸¶¨·½Ê½£º
£¨1£©
Á¬½ÓÑ¡Ïî
–libpath
£¨2£©
»·¾³±äÁ¿
ARMLIB
ÓÅÏȼ¶£º
libpath
¸ßÓÚ
ARMLIB
±»Ö¸¶¨µÄ·¾¶£º
°üº¬
a ......
ÔÚ´óÐÍCÓïÑÔÏîÄ¿¹¤³Ì»òÕßlinuxÄÚºËÖÐÎÒÃǶ¼»á¾³£¼ûµ½Á½¸öFASTCALLºÍarmlinkage
Á½¸ö±êʶ·û(ÐÞÊηû)£¬ÄÇôËüÃǸ÷ÓÐʲô²»Í¬ÄØ£¿½ñÌì¾Í¸ø´ó¼Ò¹²Í¬·ÖÏíÒ»ÏÂ×Ô¼ºµÄÐĵÃ.
´ó¼Ò¶¼ÖªµÀÔÚ±ê×¼CϵÖк¯ÊýµÄÐβÎÔÚʵ¼Ê´«Èë²ÎÊýµÄʱºò»áÉæ¼°µ½²ÎÊý´æ·ÅµÄÎÊÌ⣬ÄÇôÕâЩ²ÎÊý´æ·ÅÔÚÄÄÀïÄØ£¿ ÓÐÒ»¶¨ÀíÂÛ»ù´¡µÄ ......
×î½üÔÚcsdnµÄÂÛ̳ÉÏ·¢ÁËÕâÑùÒ»¸öÌû×ÓÈçÏÂ
int a=5;
a*=a/=a++;
ÎÒÔÚÒ»±¾¶þ¼¶cµÄÊéÉÏ¿´µ½µÄ´ð°¸ÊÇ2 ÓÉÓÚÎÒ¶Ô´ËÌâ²¢²»ÊÇÊ®·ÖÀí½â ËùÒÔÔÚÂÛ̳ÉÏ·¢±í ¿´ÓÐûÓÐÈËÄܰï׎âÊÍһϠȴûÓÐÏëµ½ÒýÀ´µÄ40¶àÂ¥µÄÒ»¸ö³¤Ìù ÒÔÖÁÓÚµ½×îºóÌÖÂÛµÄÄÚÈÝÔ¶Ô¶³¬¹ýµÄÌâÄ¿±¾Éí ÕæÊµ²»½â,ΪʲôÕâôÓÐÕùÒéµÄÌâÈ´ÄÃÀ´¿¼ÈË,Äѵ½¶¼Òª°´¶þ¼¶cµÄvc±àÒ ......