Try to understand virtual functions thoroughly! (test platform: vs2018+win10)

First, link to several blog addresses: Analysis of C + + virtual function table cout << "Virtual function table address:" << (int*)(&b) << endl; cout << "Virtual function table - first function address:" << (int*)*(int*)(&b) << endl; In this blog, cout < < virtual function table add ...

Added by ac1982 on Sat, 25 Dec 2021 19:35:10 +0200

❤️ "Have to see" once through the "seven sorting algorithms" ❤️

catalogue preface Seven sort Preview Bubble sorting Select sort Insert sort Shell Sort Merge sort Heap sort Quick sort preface The principle of bubble sorting, selection sorting and merging sorting algorithms is reprinted. Their description and introduction are illustrated with pictures and text, which is better than my recount. Th ...

Added by jimmyhumbled on Sat, 25 Dec 2021 16:59:34 +0200

Lesson 5 string

1. Basic knowledge 1. Characters and integers can be converted to each other, for example #include <iostream> using namespace std; int main() { char a1[] = {'C', '+', '+'}; cout <<"a1:" << a1 << " size:" << sizeof(a1) << endl; char a2[] = {'C', '+', '+', '\0'}; cout <<"a2:" << a2 <& ...

Added by XenoPhage on Fri, 24 Dec 2021 22:57:18 +0200

C + + -- right value reference

1, Basic knowledge 1. Function Function: R-value reference and mobile semantics are referenced in C++11, which can avoid unnecessary replication and improve program performance. 2. Basic concept of right value and discrimination from left value ① All values in C++11 must belong to one of the left value, the dead value and the pure rig ...

Added by gortron on Fri, 24 Dec 2021 14:21:45 +0200

ctc_ Derivation of loss formula and its C + + implementation

CTC introduction This article does not introduce the background and specific application of CTC. The basic knowledge of CTC can be understood through the following articles: Hannun Awni classic blog. General idea Initially, we get an input matrix. Its rows represent time steps with a length of T, and its columns represent the probabiliti ...

Added by stuckwithcode on Fri, 24 Dec 2021 11:37:27 +0200

C + + -- memory layout of class objects under inheritance structure

catalogue virtual application scenario: Normal inheritance (excluding virtual functions) Normal inheritance (including virtual function) Virtual inheritance (excluding virtual functions) Virtual inheritance (including virtual functions) First, define several concepts: Abstract class: classes containing pure virtual functions are called ...

Added by hoogeebear on Fri, 24 Dec 2021 07:27:45 +0200

On the importance of algorithm in C language

Recently, I have been learning data structures and algorithms. I deeply feel that our language learning is always just a tool, and the method is the most important part. In this article, I will illustrate the importance of algorithm, that is, the idea of writing program, in the program through several examples. catalogue 1, Question 1 (pri ...

Added by ffdave77 on Fri, 24 Dec 2021 03:55:42 +0200

Summary of ranking methods (stability and complexity issues)

Summary of ranking methods (stability and complexity issues) preface Data structure final exam, to analyze various sorting methods, complexity problems and stability problems, let's summarize here. I hope it can help you who are reading this article! ( ^ - ^ )! stability Generally speaking, the so-called stability is that if there are t ...

Added by TheAngst on Thu, 23 Dec 2021 14:43:28 +0200

C + + linked list entry exercise

Find program 2 in the comments (insert several nodes in the FRONT of the list). Modify The program inserts only three (3) nodes in front of the list. Test procedure. Q1 solution: Classes and functions remain unchanged. This is one of the main reasons for using functions, That is, we can change one function (or main function) while leaving eve ...

Added by stubarny on Thu, 23 Dec 2021 09:27:01 +0200

c + + file operation

catalogue File operation text file Binary file File operation The data generated when the program runs belongs to temporary data. Once the program runs, it will be released Data can be persisted through files File operations in c + + need to include the header < fstream > There are two types of files: 1) text file - the file is ...

Added by eugeniu on Thu, 23 Dec 2021 04:39:50 +0200