#include <stdio.h>#include "event2/event.h"#include <unistd.h>void stdin_callback(evutil_socket_t fd,short what,void *arg){ char buf[1024]; struct event* ev = (struct event*)arg;
class A{ public: static const int a = 10; //修饰成员变量时,就地初始化。既不放在初始化列表中,也不放在类外。 };
class A{ int x; int y; static int share; //类内声明 } int A::share = 100; //类外定义初始化,不需要写static关键字 void main() { cout << sizeof(A) << endl; //大小是8,static修饰的成员,不占用类内空间 co
https://www.cnblogs.com/invisible2/p/6905892.html
Copyright © 2005-2024 51CTO.COM 版权所有 京ICP证060544号