C + + foundation -- classes and objects (middle) -- constructor, destructor, copy construction

1. The default six member functions of the class If there is nothing in a class, it is referred to as an empty class. Is there nothing in the empty class? No, if I don't implement any class, the following six default member functions will be generated automatically Default member functions: they are special member functions. If we don't imp ...

Posted by amedhussaini on Thu, 20 Jan 2022 19:55:48 +0100

C/C + + memory management

C/C + + memory management C/C + + memory distribution Let's start with the following code: int globalVar = 1; static int staticGlobalVar = 1; void Test() { static int staticVar = 1; int localVar = 1; int num1[10] = { 1, 2, 3, 4 }; char char2[] = "abcd"; char* pChar3 = "abcd"; int* ptr1 = (int*)malloc(sizeof (int)* 4); int* ptr2 = ...

Posted by Valdoua on Thu, 20 Jan 2022 19:32:50 +0100

C + + chrono library for processing date and time

C++11 provides a date and time related library, chrono. Through chrono library, you can easily deal with date and time, which provides convenience for program development. The chrono library mainly contains three types of classes: time interval duration, clock, and time point. Time interval duration Common class members Duration refers to a ...

Posted by mlin on Thu, 20 Jan 2022 17:14:00 +0100

Deeply understand the union (common body) and struct of C language

A Union is defined in the following format: union Common body name { Member list }; //A common body is sometimes called a Union or a Union, which is also the original meaning of the word Union. Difference between structure and common body: each member of structure will occupy different memory and have no influence on each other ...

Posted by afern03 on Thu, 20 Jan 2022 13:36:24 +0100

[c + +] notes on c + + basic syntax

Basics The statement ends with a semicolon compile g++ name.cpp -o new_name # gcc for c language # g for c + +++ implement ./name Standard library Core language: provides all building blocks, including variables, data types, constants, etcc + + Standard Library: provides a large number of functions for manipulating objects such as fi ...

Posted by Hallic7 on Thu, 20 Jan 2022 13:12:31 +0100

C + + learning diary - operator overloading and inheritance

1, Greater than operator overload #include <iostream> using namespace std; class Student { public: Student(string n, int i, float s) { this->id = i; this->name = n; this->scored = s; } bool operator>(Student &s) { if (this->scored > s.scored) { ...

Posted by skizzay on Thu, 20 Jan 2022 12:44:34 +0100

Introduction to C + + Step03 [string and pointer]

Common string handling functions: String concatenation function: (strcat) char * strcat (char destination[], const char source[]); //Function: connect the string of parameter 2 to the end of the first parameter string //Return value: the first address of the first string //Note: ensure that the space length of parameter 1 is enough to store t ...

Posted by jannoy on Thu, 20 Jan 2022 06:31:06 +0100

HNU software capability training 2-6 Flight chess

Write in front Hello! Welcome to my blog, I hope my ideas can help you! Problem description Everyone must have played flying chess. Now, the chess that Lele and Yueyue want to play is very similar to this, but it's a little simpler. The chessboard is composed of N grids, marked as grid 0 to grid N-1 respectively. There are two kinds of grid ...

Posted by ninib on Thu, 20 Jan 2022 05:41:29 +0100

C + + learning diary - polymorphism, pure virtual functions and abstract classes, virtual destruct and pure virtual destruct, file operation

1, Basic concepts of polymorphism Polymorphism is one of the three characteristics of C + + object-oriented. Polymorphisms fall into two categories: Static polymorphism: function overloading and operator overloading Dynamic polymorphism: derived classes and virtual functions implement runtime polymorphism, Virtual is added before the funct ...

Posted by poisa on Wed, 19 Jan 2022 22:19:51 +0100

Data structure and algorithm

catalogue Object oriented programming Complexity analysis Linked list Unidirectional linked list Bidirectional linked list Circular linked list Jump linked list Sparse table Stack and queue Stack: (last in, first out) Queue: (first in, first out) Queue with two stacks Stack with two queues recursion Recursive implementation of fa ...

Posted by BinaryStar on Wed, 19 Jan 2022 21:56:26 +0100