C++
文章平均质量分 68
白衣剑少
衣上征尘杂酒痕,远游无处不消魂。
此人合是诗人未?细雨骑驴入剑门。
展开
-
C++之enum用法简介
代码: #include <iostream> using namespace std; enum fruit { apple, oringe, banana, watermelonl } myfruit; int main() { myfruit = banana; switch (myfruit) { case apple: cout << "apple is here.\n"; break; case banana: cout <<原创 2020-10-31 12:26:04 · 644 阅读 · 0 评论 -
C++之virtual虚函数的几种用法
1. virtual function base class(virtual ), derived class(override) 2. virtual destructor 3. pure virtual function it is Claimed in base class without implementation, and enforce the subclass (derived class) to implement原创 2020-11-04 21:12:45 · 554 阅读 · 0 评论 -
C++之Stack vs Heap
一、预备知识—程序的内存分配 一个由C/C++编译的程序占用的内存分为以下几个部分 1、栈区(stack)— 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等。其 操作方式类似于数据结构中的栈。 2、堆区(heap) — 一般由程序员分配释放, 若程序员不释放,程序结束时可能由OS回 收 。注意它与数据结构中的堆是两回事,分配方式倒是类似于链表,呵呵。 3、全局区(.........原创 2018-11-09 09:18:05 · 110 阅读 · 0 评论 -
C/C++之pointer
Refer to new memory reserved during program execution Refer and share large data structures without making a copy of the structures To specify relationship among data-linked lists, trees, graphs...原创 2019-06-11 21:24:09 · 244 阅读 · 0 评论