![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
笔试面试
乔巴好萌
目前只会Go C++ python Java
展开
-
C++中不能被继承的类的实现
首先,了解下什么是虚继承-- 为了解决菱形继承的多义性 #include using namespace std; class Animal { public: void foo() { cout "Animal foo"endl; } }; class Mammal : public virtual Animal { }; class W原创 2013-03-29 13:08:06 · 782 阅读 · 0 评论 -
C++默认成员函数使用说明
1) 默认构造函数 2) 默认析构函数 3) 拷贝构造 4) 赋值函数 5) 缺省取值 6) 缺省取值(const) 对于后2个,之前还真没注意到是操作符重载,现在记录下: #include using namespace std; class MyClass { public: MyClass(int value) { mValue =原创 2013-03-28 23:12:51 · 821 阅读 · 0 评论 -
如何检测CPU是大端还是小端
MSB 最高有效位 LSB 最低有效位 所谓的大端 值得是最高有效位放在最低地址 小端,则是最低有效位放在最低地址 #include int main() { union ut{ short s; char c[2]; }u; if(sizeof(short) == 2) { u.s = 0x0102; fprintf(转载 2013-03-29 23:18:00 · 966 阅读 · 0 评论 -
字符串翻转
/*字符串翻转是常见笔试面试题,记录下来*/ #include #include void reverse( const char *src, char *dest ) { if ( src == 0 ) { return ; } int strLen = strlen(src); while ( strLen原创 2013-03-18 16:01:24 · 900 阅读 · 0 评论 -
itoa 和 atoi和字符串翻转等操作
#include using namespace std; #include #include //输入"12345",输出对应的int值 int myAtoi(const char *number) { int retval = 0; while ( '\0' != *number ) { retval = retval *1原创 2013-03-19 10:15:31 · 851 阅读 · 0 评论