
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 · 706 阅读 · 0 评论 -
C++之virtual虚函数的几种用法
1. virtual functionbase class(virtual ), derived class(override)2. virtual destructor3. pure virtual functionit is Claimed in base class without implementation, and enforce the subclass (derived class) to implement原创 2020-11-04 21:12:45 · 643 阅读 · 0 评论 -
C++之Stack vs Heap
一、预备知识—程序的内存分配一个由C/C++编译的程序占用的内存分为以下几个部分1、栈区(stack)— 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等。其操作方式类似于数据结构中的栈。2、堆区(heap) — 一般由程序员分配释放, 若程序员不释放,程序结束时可能由OS回收 。注意它与数据结构中的堆是两回事,分配方式倒是类似于链表,呵呵。3、全局区(.........原创 2018-11-09 09:18:05 · 169 阅读 · 0 评论 -
C/C++之pointer
Refer to new memory reserved during program executionRefer and share large data structures without making a copy of the structuresTo specify relationship among data-linked lists, trees, graphs...原创 2019-06-11 21:24:09 · 305 阅读 · 0 评论