Objects and Classes (对象和类)

Objects and Classes [对象和类]

  • 1. Procedural and Object-Oriented Programming (过程性编程和面向对象编程)
  • 2. Abstraction and Classes (抽象和类)
    • 2.1. Classes in C++ (C++ 中的类)
    • 2.2. Implementing Class Member Functions (实现类成员函数)
    • 2.3. Using Classes
  • References

Object-oriented programming (OOP) is a particular conceptual approach to designing programs, and C++ has enhanced C with features that ease the way to applying that approach.
面向对象编程 (OOP) 是一种特殊的、设计程序的概念性方法,C++ 通过一些特性改进了 C 语言,使得应用这种方法更容易。

ease [iːz]:v. 缓解,减轻,放松,降低 n. 容易,安逸,自在,舒适

The following are the most important OOP features:

  • Abstraction (抽象)
  • Encapsulation and data hiding (封装和数据隐藏)
  • Polymorphism (多态)
  • Inheritance (继承)
  • Reusability of code (代码的可重用性)

The class is the single most important C++ enhancement for implementing these features and tying them together.
为了实现这些特性并将它们组合在一起,C++ 所做的最重要的改进是提供了类。

1. Procedural and Object-Oriented Programming (过程性编程和面向对象编程)

In short, with a procedural approach, you first concentrate on the procedures you will follow and then think about how to represent the data.
采用过程性编程方法时,首先考虑要遵循的步骤,然后考虑如何表示这些数据。

In short, with an OOP approach, you concentrate on the object as the user perceives it, thinking about the data you need to describe the object and the operations that will describe the user’s interaction with the data. After you develop a description of that interface, you move on to decide how to implement the interface and data storage. Finally, you put together a program to use your new design.
采用 OOP 方法时,首先从用户的角度考虑对象,描述对象所需的数据以及描述用户与数据交互所需的操作。完成对接口的描述后,需要确定如何实现接口和数据存储。最后,使用新的设计方案创建出程序。

perceive [pə(r)ˈsiːv]:v. 认为,意识到,注意到,察觉到

2. Abstraction and Classes (抽象和类)

Life is full of complexities, and one way we cope with complexity is to frame simplifying abstractions. From abstraction, it is a short step to the user-defined type, which in C++ is a class design that implements the abstract interface.
生活中充满复杂性,处理复杂性的方法之一是简化和抽象。抽象是通往用户定义类型的捷径,在 C++ 中,用户定义类型指的是实现抽象接口的类设计。

For built-in types, the information about operations is built in to the compiler. But when you define a user-defined type in C++, you have to provide the same kind of information yourself. In exchange for this extra work, you gain the power and flexibility to custom fit new data types to match real-world requirements.
对于内置类型来说,有关操作的信息被内置到编译器中。但在 C++ 中定义用户自定义的类型时,必须自己提供这些信息。付出这些劳动换来了根据实际需要定制新数据类型的强大功能和灵活性。

2.1. Classes in C++ (C++ 中的类)

A class is a C++ vehicle for translating an abstraction to a user-defined type. It combines data representation and methods for manipulating that data into one neat package.
类是一种将抽象转换为用户定义类型的 C++ 工具,它将数据表示和操纵数据的方法组合成一个整洁的包。

Generally, a class specification has two parts:

  • A class declaration, which describes the data component, in terms of data members, and the public interface, in terms of member functions, termed methods
    类声明:以数据成员的方式描述数据部分,以成员函数 (被称为方法) 的方式描述公有接口。

  • The class method definitions, which describe how certain class member functions are implemented
    类方法定义:描述如何实现类成员函数。

Roughly speaking, the class declaration provides a class overview, whereas the method definitions supply the details.
类声明提供了类的蓝图,而方法定义则提供了细节。

An interface is a shared framework for interactions between two systems. But in any case, to use a class, you need to know its public interface; to write a class, you need to create its public interface.
接口是一个共享框架,供两个系统交互时使用。要使用某个类,必须了解其公共接口;要编写类,必须创建其公共接口。

Typically, C++ programmers place the interface, in the form of a class definition, in a header file and place the implementation, in the form of code for the class methods, in a source code file.
C++ 程序员将接口 (类定义) 放在头文件中,并将实现 (类方法的代码) 放在源代码文件中。

In this context the keywords class and typename are not synonymous the way they were in template parameters; typename can’t be used here.
C++ 关键字 class 指出这些代码定义了一个类设计,在这里关键字 classtypename 不是同义词,不能使用 typename 代替 class (不同于在模板参数中)。Stock 是这个新类的类型名,该声明让我们能够声明 Stock 类型的变量称为对象或实例。

#ifndef STOCK_H_
#define STOCK_H_#include <string>// class declaration
class Stock {
private:std::string company;int shares;double share_val;double total_val;void SetTot() { total_val = shares * share_val; }
public:Stock(); // Default constructorStock(const std::string &company, const long num = 0, const double price = 0.0);~Stock();void Buy(const long num, const double price);void Sell(const long num, const double price);void Update(const double price);void Show()const;const Stock &Topval(const Stock &stock) const;
}; // Note semicolon at the end#endif

1. Access Control (访问控制)

Also new are the keywords private and public. These labels describe access control for class members. Any program that uses an object of a particular class can access the public portions directly. A program can access the private members of an object only by using the public member functions (or via a friend function). For example, the only way to alter the shares member of the Stock class is to use one of the Stock member functions. Thus, the public member functions act as go-betweens between a program and an object’s private members; they provide the interface between object and program. This insulation of data from direct access by a program is called data hiding.
关键字 privatepublicprotected 描述了对类成员的访问控制。使用类对象的程序都可以直接访问公有部分,但只能通过公有成员函数 (或友元函数) 来访问对象的私有成员。例如,要修改 Stock 类的 shares 成员,只能通过 Stock 的成员函数。因此,公有成员函数是程序和对象的私有成员之间的桥梁,提供了对象和程序之间的接口。防止程序直接访问数据被称为数据隐藏。

insulation [ˌɪnsjʊˈleɪʃ(ə)n]:n. 绝缘,隔热,隔音,隔热材料

在这里插入图片描述

The Stock class.

A class design attempts to separate the public interface from the specifics of the implementation. The public interface represents the abstraction component of the design. Gathering the implementation details together and separating them from the abstraction is called encapsulation. Data hiding (putting data into the private section of a class) is an instance of encapsulation, and so is hiding functional details of an implementation in the private section, as the Stock class does with SetTot(). Another example of encapsulation is the usual practice of placing class function definitions in a separate file from the class declaration.
类设计尽可能将公有接口与实现细节分开。公有接口表示设计的抽象组件,将实现细节放在一起并将它们与抽象分开被称为封装。数据隐藏 (将数据放在类的私有部分中) 是一种封装,将实现的细节隐藏在私有部分中,就像 Stock 类对 SetTot() 所做的那样,也是一种封装。封装的另一个例子是将类函数定义和类声明放在不同的文件中。

OOP is a programming style that you can use to some degree with any language.
OOP 是一种编程风格,从某种程度说,它用于任何一种语言中。

Note that data hiding not only prevents you from accessing data directly, but it also absolves you (in the roll as a user of the class) from needing to know how the data is represented.
数据隐藏不仅可以防止直接访问数据,还让开发者 (类的用户) 无需了解数据是如何被表示的。

absolve [əbˈzɒlv]:v. 宣告 ... 无罪,判定 ... 无责,赦免 ... 的罪

2. Member Access Control (控制对成员的访问)

You can declare class members, whether they are data items or member functions, either in the public or the private section of a class. But because one of the main precepts of OOP is to hide the data, data items normally go into the private section. The member functions that constitute the class interface go into the public section; otherwise, you can’t call those functions from a program. As the Stock declaration shows, you can also put member functions in the private section. You can’t call such functions directly from a program, but the public methods can use them. Typically, you use private member functions to handle implementation details that don’t form part of the public interface.
无论类成员是数据成员还是成员函数,都可以在类的公有部分或私有部分中声明它。但由于隐藏数据是 OOP 主要的目标之一,因此数据项通常放在私有部分,组成类接口的成员函数放在公有部分;否则,就无法从程序中调用这些函数。正如 Stock 声明所表明的,也可以把成员函数放在私有部分中。不能直接从程序中调用这种函数,但公有方法却可以使用它们。通常,程序员使用私有成员函数来处理不属于公有接口的实现细节。

You don’t have to use the keyword private in class declarations because that is the default access control for class objects:

class World
{float mass; // private by defaultchar name[20]; // private by default
public:void tellall(void);...
};

However, this book explicitly uses the private label in order to emphasize the concept of data hiding.
然而,为强调数据隐藏的概念,本书显式地使用了 private

Class descriptions look much like structure declarations with the addition of member functions and the public and private visibility labels. In fact, C++ extends to structures the same features classes have. The only difference is that the default access type for a structure is public, whereas the default type for a class is private. C++ programmers commonly use classes to implement class descriptions while restricting structures to representing pure data objects (often called plain-old data structures, or POD structures).
类描述看上去很像是包含成员函数以及 publicprivate 可见性标签的结构声明。实际上,C++ 对 struct 进行了扩展,使之具有与 class 相同的特性。它们之间唯一的区别是,struct 的默认访问类型是 public,而 class 的默认访问类型为 privateC++ 程序员通常使用类来实现类描述,而把结构限制为只表示纯粹的数据对象,常被称为普通老式数据结构 (Plain Old Data,POD)。

2.2. Implementing Class Member Functions (实现类成员函数)

Member function definitions are much like regular function definitions. Each has a function header and a function body. Member function definitions can have return types and arguments. But they also have two special characteristics:

  • When you define a member function, you use the scope-resolution operator (::) to identify the class to which the function belongs.
    定义成员函数时,使用作用域解析运算符 (::) 来标识函数所属的类。
  • Class methods can access the private components of the class.
    类方法可以访问类的 private 组件。

The function header for a member function uses the scope-resolution operator (::) to indicate to which class the function belongs.
成员函数的函数头使用作用域运算符解析 (::) 来指出函数所属的类。

For example, the header for the Update() member function looks like this:

void Stock::Update(double price)

This notation means you are defining the Update() function that is a member of the Stock class. Not only does this identify Update() as a member function, it means you can use the same name for a member function for a different class.

For example, an Update() function for a Buffoon class would have this function header:

void Buffoon::Update()

Thus, the scope-resolution operator resolves the identity of the class to which a method definition applies. We say that the identifier Update() has class scope. Other member functions of the Stock class can, if necessary, use the Update() method without using the scope-resolution operator. That’s because they belong to the same class, making Update() in scope.
因此,作用域解析运算符确定了方法定义对应的类的身份。我们说,标识符 Update() 具有类作用域 (class scope)。Stock 类的其他成员函数不必使用作用域解析运算符就可以使用 Update() 方法,这是因为它们属于同一个类, 因此 Update() 是可见的。

One way of looking at method names is that the complete name of a class method includes the class name. Stock::Update() is called the qualified name of the function. A simple Update(), on the other hand, is an abbreviation (the unqualified name) for the full name - one that can be used just in class scope.
类方法的完整名称中包括类名。Stock::Update() 是函数的限定名 (qualified name),而简单的 Update() 是全名的缩写 (非限定名,unqualified name) ,它只能在类作用域中使用。

The second special characteristic of methods is that a method can access the private members of a class.
方法可以访问类的私有成员。

If you try to use a nonmember function to access these data members, the compiler stops you cold in your tracks. (However, friend functions provide an exception.)
如果试图使用非成员函数访问这些数据成员,编译器禁止这样做 (友元函数例外) 。

1. Member Function Notes (成员函数说明)

Because this function is merely the means of implementing the code and not part of the public interface, the class makes SetTot() a private member function. (That is, SetTot() is a member function used by the person writing the class but not used by someone writing code that uses the class.)
由于 SetTot() 只是实现代码的一种方式,而不是公有接口的组成部分,因此这个类将其声明为私有成员函数 ( 即编写这个类的人可以使用它, 但编写代码来使用这个类的人不能使用) 。

2. Inline Methods (内联方法)

Any function with a definition in the class declaration automatically becomes an inline function. Thus, Stock::SetTot() is an inline function. Class declarations often use inline functions for short member functions, and SetTot() qualifies on that account.
定义位于类声明中的函数都将自动成为内联函数,因此 Stock::SetTot() 是一个内联函数。类声明常将短小的成员函数作为内联函数,SetTot() 符合这样的要求。

You can, if you like, define a member function outside the class declaration and still make it inline. To do so, you just use the inline qualifier when you define the function in the class implementation section:
如果愿意,也可以在类声明之外定义成员函数,并使其成为内联函数。为此,只需在类实现部分中定义函数时使用 inline 限定符即可:

class Stock
{
private:...void SetTot(); // definition kept separate
public:...
};inline void Stock::SetTot() // use inline in definition
{total_val = shares * share_val;
}

The special rules for inline functions require that they be defined in each file in which they are used. The easiest way to make sure that inline definitions are available to all files in a multifile program is to include the inline definition in the same header file in which the corresponding class is defined.
内联函数的特殊规则要求在每个使用它们的文件中都对其进行定义。确保内联定义对多文件程序中的所有文件都可用的、最简便的方法是:将内联定义放在定义类的头文件中 。

Incidentally, according to the rewrite rule, defining a method within a class declaration is equivalent to replacing the method definition with a prototype and then rewriting the definition as an inline function immediately after the class declaration. That is, the original inline definition of SetTot() is equivalent to the one just shown, with the definition following the class declaration.
根据改写规则 (rewrite rule),在类声明中定义方法等同于用原型替换方法定义,然后在类声明的后面将定义改写为内联函数。程序清单中 SetTot() 的内联定义与上述代码 (定义紧跟在类声明之后) 是等价的。

When you call a member function, it uses the data members of the particular object used to invoke the member function.
调用成员函数时,它将使用被用来调用它的对象的数据成员。

Each new object you create contains storage for its own internal variables, the class members. But all objects of the same class share the same set of class methods, with just one copy of each method.
所创建的每个新对象都有自己的存储空间,用于存储其内部变量和类成员;但同一个类的所有对象共享同一组类方法,即每种方法只有一个副本。

They just apply the code to different data. Calling a member function is what some OOP languages term sending a message. Thus, sending the same message to two different objects invokes the same method but applies it to two different objects
它们将执行同一个代码块,只是将这些代码用于不同的数据。在 OOP 中,调用成员函数被称为发送消息,因此将同样的消息发送给两个不同的对象将调用同一个方法,但该方法被用于两个不同的对象。

在这里插入图片描述

Objects, data, and member functions.

2.3. Using Classes

The C++ goal is to make using classes as similar as possible to using the basic, built-in types, such as int and char. You can create a class object by declaring a class variable or using new to allocate an object of a class type.
C++ 的目标是使得使用类与使用基本的内置类型 (例如 intchar) 尽可能相同。要创建类对象,可以声明类变量,也可以使用 new 为类对象分配存储空间。

1. The Client / Server Model

OOP programmers often discuss program design in terms of a client / server model. In this conceptualization, the client is a program that uses the class. The class declaration, including the class methods, constitute the server, which is a resource that is available to the programs that need it. The client uses the server through the publicly defined interface only. This means that the client’s only responsibility, and, by extension, the client’s programmer’s only responsibility, is to know that interface. The server’s responsibility, and, by extension, the server’s designer’s responsibility, is to

see that the server reliably and accurately performs according to that interface. Any changes the server designer makes to the class design should be to details of implementation, not to the interface. This allows programmers to improve the client and the server independently of each other, without changes in the server having unforeseen repercussions on the client’s behavior.
OOP 程序员常依照客户/服务器模型来讨论程序设计。在这个概念中,客户是使用类的程序。类声明 (包括类方法) 构成了服务器,它是程序可以使用的资源。客户只能通过以公有方式定义的接口使用服务器,这意味着客户 (客户程序员) 唯一的责任是了解该接口。服务器 (服务器设计人员) 的责任是确保服务器根据该接口可靠并准确地执行。服务器设计人员只能修改类设计的实现细节,而不能修改接口。这样程序员独立地对客户和服务器进行改进,对服务器的修改不会客户的行为造成意外的影响。

You can avoid e-notation by using the setf() method

std::cout.setf(std::ios_base::fixed, std::ios_base::floatfield);

This sets a flag in the std::cout object instructing cout to use fixed-point notation.
设置 std::cout 对象的一个标记,命令 std::cout 使用定点表示法。使用方法 std::cout.setf(),便可避免科学计数法

Similarly, the following statement causes std::cout to show three places to the right of the decimal when using fixed-point notation.
下面的语句设置 std::cout 在使用定点表示法时,显示 3 位小数

std::cout.precision(3);

The class declaration is modeled after a structure declaration and can include data members and function members. The declaration has a private section, and members declared in that section can be accessed only through the member functions. The declaration also has a public section, and members declared there can be accessed directly by a program using class objects.
类声明类似结构声明,可以包括数据成员和函数成员。声明私有部分,在其中声明的成员只能通过成员函数进行访问;声明公有部分,在其中声明的成员可被使用类对象的程序直接访问。通常,数据成员被放在私有部分中,成员函数被放在公有部分中。

Typically, data members go into the private section and member functions go into the public section, so a typical class declaration has this form:

class className
{
private:data member declarations
public:member function prototypes
};

The contents of the public section constitute the abstract part of the design, the public interface. Encapsulating data in the private section protects the integrity of the data and is called data hiding.
公有部分的内容构成了设计的抽象部分 - 公有接口。将数据封装到私有部分中可以保护数据的完整性,这被称为数据隐藏。

You can use a complete function definition instead of a function prototype in the class declaration, but the usual practice, except with very brief functions, is to provide the function definitions separately. In that case, you need to use the scope-resolution operator to indicate to which class a member function belongs.
可以在类声明中提供完整的函数定义,而不是函数原型,但是通常的做法是单独提供函数定义 (除非函数很小)。在这种情况下,需要使用作用域解析运算符来指出成员函数属于哪个类。

For example, suppose the Bozo class has a member function called Retort() that returns a pointer to a char. The function header would look like this:

char * Bozo::Retort()

In other words, Retort() is not just a type char * function; it is a type char * function that belongs to the Bozo class. The full, or qualified, name of the function is Bozo::Retort().The name Retort(), on the other hand, is an abbreviation of the qualified name, and it can be used only in certain circumstances, such as in the code for the class methods.
Retort() 不仅是一个 char * 类型的函数,而是一个属于 Bozo 类的 char * 函数。该函数的全名 (或限定名) 为 Bozo::Retort()。而名称 Retort() 是限定名的缩写,只能在某些特定的环境中使用。

The name Retort() has class scope, so the scope-resolution operator is needed to qualify the name when it is used outside the class declaration and a class method.
名称 Retort() 的作用域为整个类,因此在类声明和类方法之外使用该名称时,需要使用作用域解析运算符进行限定。

要创建对象 (类的实例),只需将类名视为类型名即可:

Bozo bozetta;

This works because a class is a user-defined type. You invoke a class member function, or method, by using a class object. You do so by using the dot membership operator: std::cout << Bozetta.Retort();
这样做是可行的,因为类是用户定义的类型。类成员函数 (方法) 可通过类对象来调用。为此,需要使用成员运算符句点。

This invokes the Retort() member function, and whenever the code for that function refers to a particular data member, the function uses the value that member has in the bozetta object.
这将调用 Retort() 成员函数,每当其中的代码引用某个数据成员时,该函数都将使用 bozetta 对象中相应成员的值。

References

[1] Yongqiang Cheng, https://yongqiang.blog.csdn.net/
[2] C++ Primer Plus, 6th Edition, https://www.informit.com/store/c-plus-plus-primer-plus-9780321776402

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/361877.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

MyPostMan:按照项目管理接口,基于迭代生成接口文档、执行接口自动化联合测试

MyPostMan 是一款类似 PostMan 的接口请求软件&#xff0c;不同于 PostMan 的是&#xff0c;它按照 项目&#xff08;微服务&#xff09;、目录来管理我们的接口&#xff0c;基于迭代来管理我们的接口文档&#xff0c;可导出或者在局域网内共享&#xff0c;按照迭代编写自动化测…

微信小程序-自定义组件checkbox

一.自定义Coponent组件 公共组件&#xff1a;将页面内公共的模块抽取为自定义组件&#xff0c;在不同页面复用。 页面组件&#xff1a;将复杂页面进行拆分&#xff0c;降低耦合度&#xff0c;有利于代码维护。 可以新建文件夹component放组件&#xff1a; 组件名为custom-che…

【Unity】Timeline的倒播和修改速度(无需协程)

unity timeline倒播 一、核心: 通过playableDirector.playableGraph.GetRootPlayable(i).SetSpeed(speed)接口,设置PlayableDirector的速度。 二、playableGraph报空 若playableDirector不勾选Play On Awake,则默认没有PlayableGraph,需执行playableDirector…RebuildGr…

mysql备份和恢复

目录 一、数据库备份的分类 二、常见的备份方法 三、MySQL完全备份 1&#xff09;数据库完全备份与恢复 2&#xff09;mysqldump备份与恢复 1、完全备份一个或多个完整的库&#xff08;包括其中所有的表&#xff09; 2、完全备份 MySQL 服务器中所有的库 3、完全备份某…

Qt Quick Effect Maker 工具使用介绍

一、介绍 随着 Qt 版本的不断升级,越来越多的功能被加入 Qt,一些新的工具也随之应运而生,Qt Quick Effect Maker 工具是 Qt 6.5 之后才新添加的工具,之前的名字应该是叫做 Qt shader tool 这个模块。 以下是官方的释义:Qt Quick Effect Maker是一个用于为Qt Quick创建自定…

DC/AC电源模块一种效率与可靠性兼备的能源转换解决方案

DC/AC电源模块都是一种效率与可靠性兼备的能源转换解决方案 DC/AC电源模块是一种能够将直流电源&#xff08;DC&#xff09;转换为交流电源&#xff08;AC&#xff09;的设备。它在现代电子设备中扮演着非常重要的角色&#xff0c;因为许多设备需要交流电源才能正常运行。无论…

金融科技行业创新人才培养与引进的重要性及挑战

金融科技行业作为金融与科技的深度融合产物&#xff0c;正以前所未有的速度改变着传统金融业的格局。在这一变革中创新人才的培养与引进成为了行业发展的核心驱动力。然而&#xff0c;尽管其重要性不言而喻&#xff0c;但在实际操作中却面临着诸多挑战。 一、创新人才培养与引进…

echarts 5.5.0版本下的层叠柱形图,每个值都从0开始,会有覆盖情况

需求&#xff1a; 1、每个公司&#xff0c;需要两个柱子去展示&#xff08;stack: 1是第一个柱子&#xff0c;stack:2,是第二个柱子&#xff09;&#xff1b; 2、必须每个数据都是从0开始&#xff0c;不在上一个值上累加&#xff1b; 3、鼠标滑上去的时候&#xff0c;最大值…

ffmpeg音视频开发从入门到精通——ffmpeg日志及目录操作

文章目录 FFMPEG1. 操作日志2. 文件移动和删除3. 操作目录重要函数 FFMPEG 1. 操作日志 日志级别 AV LOG ERROR AV LOG WARNING AV LOG INFO AV LOG DEBUG cmake_minimum_required(VERSION 3.27) project(FFmpeg_exercise) set(CMAKE_CXX_STANDARD 14)# 定义FFmpeg的安装路…

基于Java技术的在线学习平台系统

开头语&#xff1a;你好呀&#xff0c;我是计算机学姐码农小野&#xff01;如果有相关需求&#xff0c;可以私信联系我。 开发语言&#xff1a;Java 数据库&#xff1a;MySQL 技术&#xff1a;Java技术&#xff0c;基于SpringBoot框架 工具&#xff1a;Eclipse、Navicat、M…

【ocean】ocnPrin结合getData导出数据

核心就是这一句ocnPrint(?output fout leafValue( getData(“/output” ?result “dc”))) r_list list(4000, 4100, 4200) multi_list list(20,21,22) fout outfile("/home/yourpath/results.txt" "w") foreach(r_value r_listforeach(multi_value …

Redis数据库(六):主从复制和缓存穿透及雪崩

目录 一、Redis主从复制 1.1 概念 1.2 主从复制的作用 1.3 实现一主二从 1.4 哨兵模式 1.4.1 哨兵的作用 1.4.2 哨兵模式的优缺点 二、Redis缓存穿透和雪崩 2.1 缓存穿透——查不到 2.1.1 缓存穿透解决办法 2.2 缓存击穿 - 量太大&#xff0c;缓存过期 2.2.1 缓存…

高频面试题基本总结回顾2(含笔试高频算法整理)

干货分享&#xff0c;感谢您的阅读&#xff01; &#xff08;暂存篇---后续会删除&#xff0c;完整版和持续更新见高频面试题基本总结回顾&#xff08;含笔试高频算法整理&#xff09;&#xff09; 备注&#xff1a;引用请标注出处&#xff0c;同时存在的问题请在相关博客留言…

如何快速解决验证码图像问题 | 最佳图像(OCR)验证码解决工具

你是否曾经遇到过陷入一个看似无尽的 CAPTCHA 挑战中&#xff0c;努力识别扭曲的字符或数字&#xff1f;这些令人抓狂的 CAPTCHA 是为了确保你是人类而不是机器人&#xff0c;但它们也给真正的用户带来了头痛。那么&#xff0c;有没有快速解决这些 CAPTCHA 图像的方法&#xff…

Vue-Ci搭建项目

项目创建 vue-cli 官方提供的一个脚手架,用于快速生成一个vue的项目模板;预先定义 好的目录结构及基础代码,就好比咱们在创建Maven项目时可以选择创建一个 骨架项目,这个骨架项目就是脚手架,我们的开发更加的快速; 主要的功能 ● 统一的目录结构 ● 本地调试 热部署 ● 单元…

华为OD机试 - 石头剪刀布游戏(Java 2024 D卷 200分)

华为OD机试 2024D卷题库疯狂收录中&#xff0c;刷题点这里 专栏导读 本专栏收录于《华为OD机试&#xff08;JAVA&#xff09;真题&#xff08;D卷C卷A卷B卷&#xff09;》。 刷的越多&#xff0c;抽中的概率越大&#xff0c;每一题都有详细的答题思路、详细的代码注释、样例测…

设备驱动框架之LED

文章目录 前言一、什么是驱动框架二、使用步骤1.注册LED设备2.卸载LED设备3.内核中申请内存4.container_of5.platform_get_drvdata 和 platform_set_drvdata6.module_platform_driver 三、驱动示例总结 前言 为了尽量降低驱动开发者难度以及接口标准化&#xff0c;就出现了设备…

基于weixin小程序智慧物业系统的设计

管理员账户功能包括&#xff1a;系统首页&#xff0c;个人中心&#xff0c;管理员管理&#xff0c;用户管理&#xff0c;员工管理&#xff0c;房屋管理&#xff0c;缴费管理&#xff0c;车位管理&#xff0c;报修管理 工作人员账号功能包括&#xff1a;系统首页&#xff0c;维修…

数据库原理之数据库基本概念

目录 前言 基本概念 数据库完整性 前言 今天我们来看看数据库的基本概念&#xff0c;帮助大家对数据库有一点点最基本的了解 基本概念 4个基本概念 数据data&#xff1a;描述事物的符号&#xff0c;数据库中存储的基本对象。 数据库Database&#xff1a;长期存储在计算机…

基于JSP技术的旅游网站系统

开头语&#xff1a;你好呀&#xff0c;我是计算机学长猫哥&#xff01;如果有相关需求&#xff0c;文末可以找到我的联系方式。 开发语言&#xff1a;Java 数据库&#xff1a;MySQL 技术&#xff1a;B/S架构&#xff0c;JSP技术 工具&#xff1a;Eclipse&#xff0c;Tomcat…