上一页 1 ··· 94 95 96 97 98 99 100 101 102 ··· 1357 下一页
不使用C++时,很多C语言新手可能认为C语言缺乏了面向对象和抽象性,事实上,C语言通过某种组合方式,可以间接性的实现面对对象和抽象。 不过多态和继承这种实现,就有点小麻烦,但是依然可以实现。 核心: 利用 void 类型指针,可以指向任意类型指针。 通过这个我们就可以实现抽象性,让数据结构或函数不再 Read More
posted @ 2018-07-07 21:58 findumars Views(669) Comments(0) Diggs(0)
作者:陈硕链接:https://www.zhihu.com/question/22889420/answer/22975569来源:知乎著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 整个 C++ exception 的行为在常见语言中是最奇葩的, 因为这个语言特性与 C++ Read More
posted @ 2018-07-04 21:35 findumars Views(2368) Comments(0) Diggs(0)
在使用Qt开发大型软件时,难免要调试程序,以确保程序内的运算结果符合我们的预期。在不符合预期结果时,就直接将程序断下,以便我们修改。 这就用到了Qt中的调试断言 - Q_ASSERT。 用一个小例子来说一下 Q_ASSERT 断言的作用吧: 用QtCreator新建一个控制台程序,代码编写如下: # Read More
posted @ 2018-07-04 19:57 findumars Views(2234) Comments(0) Diggs(0)
C++中并不提倡继续使用C风格的字符串,而是为字符串定义了专门的类,名为string。 使用前的准备工作 在使用string类型时,需要包含string头文件,且string位于std命名空间内: #include <iostream> //... std::string str1 = "Hello Read More
posted @ 2018-07-04 00:06 findumars Views(1300) Comments(0) Diggs(1)
Memory elements This header defines general utilities to manage dynamic memory: Allocators Managed pointers Functions and classes related to shared_pt Read More
posted @ 2018-07-03 19:23 findumars Views(557) Comments(0) Diggs(0)
上一页 1 ··· 94 95 96 97 98 99 100 101 102 ··· 1357 下一页