Two class operator overload

Original link (click the original link to get more learning dry goods): Two class operator overload – Boolean bloghttp://blog.bools.cn/archives/1640 1. Overload of plus operator If you want to add or subtract a custom type, you need to write a function to overload it. Write function in member function or global function Function name ...

Added by awpti on Sun, 03 Oct 2021 20:37:12 +0300

A beginner's way to brush questions (week 3)

Review greed this week. As we all know, greed is that as long as you have the courage, you will find that, hey, you're overtime again Therefore, I think the most important thing to pay attention to this kind of problem of greed is two points. One is what we are greedy for, that is, what the problem wants us to do; The other is how to optimize ...

Added by skovela on Sun, 03 Oct 2021 01:15:42 +0300

Principle and C + + implementation of KMP algorithm

preface Recently, Feynman learning method has been practiced and applied to learning. KMP algorithm is a difficult knowledge point in data structure and algorithm. It took several days to understand the principle of this algorithm and implement it in C + +. Write this blog to sort out the principle of KMP algorithm and my C + + implementation ...

Added by phpbeginner0120 on Sat, 02 Oct 2021 05:28:19 +0300

C + + object oriented -- encapsulation

C + + object oriented encapsulation (1) Date:2021.9.7 Author:lqy 1, Three characteristics of object-oriented: Encapsulation, inheritance, polymorphism 2, Object oriented design: Encapsulation: Class definition: member attribute, member methodInstantiation of class object: create an object of class Requirements: define a circle cla ...

Added by IsmAvatar on Sat, 02 Oct 2021 00:51:50 +0300

Learning records for C + + beginners 16

Chapter 16 template and generic programming   OOP: it can handle situations where the type is unknown before the program runs Generic programming: types are known at compile time Two important principles of generic code: The function parameter in the template is the application of const (more types can be accepted with const, copy / non co ...

Added by bobbybrown on Fri, 01 Oct 2021 02:11:05 +0300

Object oriented features of C + + Learning

Construction and Deconstruction of classes After understanding the class definition syntax, class members and access member control, we will discuss the life cycle of an object, which involves two crucial activities, creation and destruction. For the actions of creating and destroying objects, we have talked about how to create an object on th ...

Added by Gestahr on Fri, 01 Oct 2021 00:26:55 +0300

C++ Getting Started - Implementing the Sew and Pin Game

Reference resources C and C++ Game Fun Programming Kid Crystal To make use of every bit of time "Pin in Seam" Game: Press the space bar and send a pin onto the disc. All the pins turn counterclockwise. If a new pin hits an existing pin, the game ends Draw discs and needles Draw a circle to represent a disc, a line segment to re ...

Added by nite4000 on Thu, 30 Sep 2021 19:05:36 +0300

Summary of new features of C + + standard 11-14

1. Evolution, environment and resources Version: c++98 (1.0), c++04, c++11 (2.0), c++142. Variable template (key and difficult) ... is a pack age, which represents any number and type of parameters Template parameters Pack: template parameters pack Function parameter types Pack: function parameter types pack Function parameter Pack: ...

Added by rweston002 on Thu, 30 Sep 2021 00:44:37 +0300

Syntax and Principle of Template in c++

Grammar and principles of C++ templates 1. Generic programming How do I implement a common exchange function? First method: using function overload to implement #include<ostream> void swap(int& a, int& b) { int temp = a; a = b; b = temp; } void swap(double& a, double& b) { double temp = a; a = b; b = temp; } int ...

Added by Dan911 on Wed, 29 Sep 2021 19:52:07 +0300

c + + learning record (7 structure)

7 structure 7.1 definition and use of structure Structures are user-defined data types, allowing users to store different data types Syntax: struct structure name {structure member list}; There are three ways to create variables through structures: struct structure name variable namestruct structure name variable name = {member 1 value, memb ...

Added by bigray on Wed, 29 Sep 2021 06:13:38 +0300