当前位置:网站首页>55 specific ways to improve program design (1)
55 specific ways to improve program design (1)
2022-06-25 15:04:00 【I know everything】
Get used to C++
Clause 01: Depending on the C++ For a language Federation
- C. At the end of the day C++ Still with C Based on . block (blocks)、 sentence (statements)、 The preprocessor (preprocessor)、 Built in data types (build-in data type)、 Array (arrays)、 The pointer (pointers) All from C. A lot of time C++ The solution to the problem is actually just a higher level C solution ( For example, clause 2 Talking about an alternative to the preprocessor , Clause 13 When it comes to managing resources with objects ), But when you take C++ Internal C When ingredients work , Efficient programming rules reflect C Language limitations : No template (templates)、 No abnormal (exceptions)、 No overloading (overloading) etc. ...
- Object-Oriented C++. This part is C with Classes Appeal :classes( Including constructors and destructors ), encapsulation (encapsulation)、 Inherit (inheritance)、 polymorphic (polymorphism)、virtual function ( Dynamic binding )...... wait . This part is the classical code of object-oriented design C++ Most direct implementation .
- Template C++. This is a C++ Generic programming for (generic programming) part , It is also the least experienced part of most programmers .template Relevant considerations and design have pervaded the whole C++, Good programming practices “ only template apply ” Special provisions are not uncommon ( For example, clause 46 When it comes to calling template function How to assist in type conversion ). In fact, because of template Powerful , They bring new paradigms (programming paradigm), It's called template metaprogramming(TMP, Template metaprogramming ). Clause 48 This provides an overview , But unless you are template The backbone of the radical team , There is no need to worry about this .TMP The relevant rules are rarely related to C++ Mainstream programming interacts .
- STL.STL It's a template library , Look at the name , But it's a very special one . It's for containers (containers)、 iterator (iterators)、 Algorithm (algorithms) And function objects (function objects) There is excellent coordination and coordination between the two protocols , However templates And libraries can also be built with other ideas .STL Have their own special way of doing things , When you are with STL Working together , You must abide by his rules .
C++ It's not an all-in-one language with a set of rules : He is a federal government composed of four sub languages , Each sub language has its own rules . Remember these four sub languages , You'll find out C++ Easy to understand a lot .
please remember
- C++ Efficient programming rules vary depending on the situation , It's up to you to use C++ Which part of .
边栏推荐
- Iterator failure condition
- From 408 to independent proposition, 211 to postgraduate entrance examination of Guizhou University
- Installing QT plug-in in Visual Studio
- Compile Caffe's project using cmake
- Two advanced playing methods of QT signal and slot
- [deep learning] multi label learning
- Async await to achieve sleep waiting effect
- Gif动图如何裁剪?收下这个图片在线裁剪工具
- Extend JS copy content to clipboard
- dmsetup命令
猜你喜欢

Jaspersoft studio adding MySQL database configuration

Design and implementation of thread pool

Ubuntu 20.04 installing mysql8.0 and modifying the MySQL password

Judging the number of leap years from 1 to N years

有哪个瞬间让你觉得这个世界出bug了?

定位position(5种方式)

‘make_ unique’ is not a member of ‘std’

Common dynamic memory errors

ffmpeg protocol concat 进行ts流合并视频的时间戳计算及其音画同步方式一点浅析

Time stamp calculation and audio-visual synchronization of TS stream combined video by ffmpeg protocol concat
随机推荐
Cross compilation correlation of curl Library
Clinical chemistry | zhangjianzhong / Xu Jian develop single cell precision diagnosis and treatment technology for Helicobacter pylori
Power automatic test system nsat-8000, accurate, high-speed and reliable power test equipment
Two advanced playing methods of QT signal and slot
Introduction to flexible array
About the problem of kicad stuck in win10 version, version 6 x
Thymeleaf Usage Summary
移除区间(贪心)
basic_ String mind map
Learning notes on February 5, 2022 (C language)
JS select all exercise
AB string interchange
dev/mapper的解释
[deep learning] multi task learning of multiple datasets data sets missing labels
Biscuit distribution
The best time to buy and sell stocks
Basic knowledge of pointer
Is it safe to open a stock account online?
System Verilog - thread
Biscuit distribution