当前位置: 首页 > news >正文

JavaScript ES6类的定义与继承

文章目录

  • 一、class方式定义类
    • 1.认识class定义类
    • 2.类和构造函数的异同
    • 3.类的构造函数
    • 4.类的实例方法
    • 5.类的访问器方法
    • 6.类的静态方法
  • 二、继承
    • 1.extends实现继承
    • 2.super关键字
    • 3.继承内置类
    • 4.类的混入mixin
  • 三、ES6转ES5
    • 1.class转换
    • 2.extends转换
  • 四、多态

一、class方式定义类

1.认识class定义类

我们会发现,按照前面的构造函数形式创建类,不仅仅和编写普通的函数过于相似,而且代码并不容易理解

  • ES6(ECMAScript2015)新的标准中使用了class关键字来直接定义类;
  • 但是类本质上依然是前面所讲的构造函数、原型链的语法糖而已;
  • 所以学好了前面的构造函数、原型链更有利于我们理解类的概念和继承关系

那么,如何使用class来定义一个类呢?

  • 可以使用两种方式来声明类:类声明和类表达式;
// 方式一 类声明
class Person {}// 方式二 类表达式
var Student = class {}

2.类和构造函数的异同

我们来研究一下类的一些特性:

  • 你会发现它和我们的构造函数的特性其实是一致的;
// function定义类
function Person1(name, age) {this.name = namethis.age = age
}Person1.prototype.running = function() {}
Person1.prototype.eating = function() {}var p1 = new Person1("why", 18)
console.log(p1.__proto__ === Person1.prototype)
console.log(Person1.prototype.constructor)
console.log(typeof Person1) // function// 不同点: 作为普通函数去调用
Person1("abc", 100)// class定义类
class Person2 {constructor(name, age) {this.name = namethis.age = age}running() {}eating() {}
}var p2 = new Person2("kobe", 30)
console.log(p2.__proto__ === Person2.prototype)
console.log(Person2.prototype.constructor)
console.log(typeof Person2)// 不同点: class定义的类, 不能作为一个普通的函数进行调用
Person2("cba", 0)

3.类的构造函数

如果我们希望在创建对象的时候给类传递一些参数,这个时候应该如何做呢?

  • 每个类都可以有一个自己的构造函数(方法),这个方法的名称是固定的constructor
  • 当我们通过new操作符,操作一个类的时候会调用这个类的构造函数constructor;
  • 每个类只能有一个构造函数,如果包含多个构造函数,那么会抛出异常

当我们通过new关键字操作类的时候,会调用这个constructor函数,并且执行如下操作:

  1. 在内存中创建一个新的对象(空对象);

  2. 这个对象内部的[[prototype]]属性会被赋值为该类的prototype属性;

  3. 构造函数内部的this,会指向创建出来的新对象;

  4. 执行构造函数的内部代码(函数体代码);

  5. 如果构造函数没有返回非空对象,则返回创建出来的新对象;

class Person {constructor(name, age) {this.name = namethis.age = age}
}

4.类的实例方法

在上面我们定义的属性都是直接放到了this上,也就意味着它是放到了创建出来的新对象中:

  • 在前面我们说过对于实例的方法,我们是希望放到原型上的,这样可以被多个实例来共享
  • 这个时候我们可以直接在类中定义;
class Person {constructor(name, age) {this.name = namethis.age = age}run(){console.log(this.name + " running~")}
}

5.类的访问器方法

我们之前讲对象的属性描述符时有讲过对象可以添加settergetter函数的,那么类也是可以的:

class Student {constructor(name, age) {this._name = namethis._age = age}set name(name) {this._name = name}get name() {return this._name}
}
var s = new Student("abc", 123)
console.log(s.name)

扩展回顾:对象的访问器方法

 // 针对对象
// 方式一: 描述符
// var obj = {
// _name: "why"
// }
// Object.defineProperty(obj, "name", {
//   configurable: true,
//   enumerable: true,
//   set: function() {
//   },
//   get: function() {
//   }
// })// 方式二: 直接在对象定义访问器
// 监听_name什么时候被访问, 什么设置新的值
var obj = {_name: "why",// setter方法set name(value) {this._name = value},// getter方法get name() {return this._name}
}obj.name = "kobe"
console.log(obj.name)

访问器的应用场景

// 2.访问器的应用场景
class Rectangle {constructor(x, y, width, height) {this.x = xthis.y = ythis.width = widththis.height = height}get position() {return { x: this.x, y: this.y }}get size() {return { width: this.width, height: this.height }}
}var rect1 = new Rectangle(10, 20, 100, 200)
console.log(rect1.position)
console.log(rect1.size)

6.类的静态方法

静态方法通常用于定义直接使用类来执行的方法,不需要有类的实例,使用static关键字来定义:

// function Person() {}
// // 实例方法
// Person.prototype.running = function() {}
// // 类方法
// Person.randomPerson = function() {}// var p1 = new Person()
// p1.running()
// Person.randomPerson()// class定义的类
var names = ["abc", "cba", "nba", "mba"]
class Person {constructor(name, age) {this.name = namethis.age = age}// 实例方法running() {console.log(this.name + " running~")}eating() {}// 类方法(静态方法)static randomPerson() {console.log(this)var randomName = names[Math.floor(Math.random() * names.length)]return new this(randomName, Math.floor(Math.random() * 100))}
}var p1 = new Person()
p1.running()
p1.eating()
var randomPerson = Person.randomPerson()
console.log(randomPerson)

二、继承

1.extends实现继承

前面我们花了很大的篇幅讨论了在ES5中实现继承的方案,虽然最终实现了相对满意的继承机制,但是过程却依然是非常繁琐的。

在ES6中新增了使用extends关键字,可以方便的帮助我们实现继承:

class Person {}
class Student extends Person {}

示例代码

// 定义父类
class Person {constructor(name, age) {this.name = namethis.age = age}running() {console.log("running~")}eating() {console.log("eating~")}
}class Student extends Person {constructor(name, age, sno, score) {// this.name = name// this.age = agesuper(name, age)this.sno = snothis.score = score}// running() {//   console.log("running~")// }// eating() {//   console.log("eating~")// }studying() {console.log("studying~")}
}var stu1 = new Student("why", 18, 111, 100)
stu1.running()
stu1.eating()
stu1.studying()class Teacher extends Person {constructor(name, age, title) {// this.name = name// this.age = agesuper(name, age)this.title = title}// running() {//   console.log("running~")// }// eating() {//   console.log("eating~")// }teaching() {console.log("teaching~")}
}

2.super关键字

我们会发现在上面的代码中我使用了一个super关键字,这个super关键字有不同的使用方式:

  • 注意:在子(派生)类的构造函数中使用this或者返回默认对象之前,必须先通过super调用父类的构造函数
  • super的使用位置有三个:子类的构造函数实例方法静态方法
class Animal {running() {console.log("running")}eating() {console.log("eating")}static sleep() {console.log("static animal sleep")}
}class Dog extends Animal {// 子类如果对于父类的方法实现不满足(继承过来的方法)// 重新实现称之为重写(父类方法的重写)running() {console.log("dog四条腿")// 调用父类的方法super.running()// console.log("running~")// console.log("dog四条腿running~")}static sleep() {console.log("趴着")super.sleep()}
}var dog = new Dog()
dog.running()
dog.eating()Dog.sleep()

3.继承内置类

我们也可以让我们的类继承自内置类,比如Array:

// 1.创建一个新的类, 继承自Array进行扩展
class HYArray extends Array {get lastItem() {return this[this.length - 1]}get firstItem() {return this[0]}
}var arr = new HYArray(10, 20, 30)
console.log(arr)
console.log(arr.length)
console.log(arr[0])
console.log(arr.lastItem)
console.log(arr.firstItem)// 2.直接对Array进行扩展
Array.prototype.lastItem = function() {return this[this.length - 1]
}var arr = new Array(10, 20, 30)
console.log(arr.__proto__ === Array.prototype)
console.log(arr.lastItem())// 函数apply/call/bind方法 -> Function.prototype

4.类的混入mixin

JavaScript的类只支持单继承:也就是只能有一个父类

那么在开发中我们我们需要在一个类中添加更多相似的功能时,应该如何来做呢?

这个时候我们可以使用混入(mixin);

// JavaScript只支持单继承(不支持多继承)
function mixinAnimal(BaseClass) {return class extends BaseClass {running() {console.log("running~")}}
}function mixinRunner(BaseClass) {return class extends BaseClass {flying() {console.log("flying~")}}
}class Bird {eating() {console.log("eating~")}
}// var NewBird = mixinRunner(mixinAnimal(Bird))
class NewBird extends mixinRunner(mixinAnimal(Bird)) {
}
var bird = new NewBird()
bird.flying()
bird.running()
bird.eating()

三、ES6转ES5

1.class转换

ES6的代码

class Person {constructor(name, age) {this.name = namethis.age = age}running() {}eating() {}static randomPerson() {}
}var p1 = new Person()

ES5的代码

"use strict";function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}
}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}
}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);Object.defineProperty(Constructor, "prototype", { writable: false });return Constructor;
}// 纯函数: 相同输入一定产生相同的输出, 并且不会产生副作用
var Person = /*#__PURE__*/ (function () {debuggerfunction Person(name, age) {_classCallCheck(this, Person);this.name = name;this.age = age;}_createClass(Person,[{key: "running",value: function running() {}},{key: "eating",value: function eating() {}}],[{key: "randomPerson",value: function randomPerson() {}}]);return Person;
})();var p1 = new Person("why", 18)

2.extends转换

ES6的代码

class Person {constructor(name, age) {this.name = namethis.age = age}running() {}eating() {}static randomPerson() {}
}class Student extends Person {constructor(name, age, sno, score) {super(name, age)this.sno = snothis.score = score}studying() {}static randomStudent() {}
}var stu = new Student()

ES5的代码

"use strict";function _typeof(obj) {"@babel/helpers - typeof";return ((_typeof ="function" == typeof Symbol && "symbol" == typeof Symbol.iterator? function (obj) {return typeof obj;}: function (obj) {return obj &&"function" == typeof Symbol &&obj.constructor === Symbol &&obj !== Symbol.prototype? "symbol": typeof obj;}),_typeof(obj));
}function _inherits(subClass, superClass) {if (typeof superClass !== "function" && superClass !== null) {throw new TypeError("Super expression must either be null or a function");}subClass.prototype = Object.create(superClass && superClass.prototype, {constructor: { value: subClass, writable: true, configurable: true }});Object.defineProperty(subClass, "prototype", { writable: false });if (superClass) _setPrototypeOf(subClass, superClass);
}function _setPrototypeOf(o, p) {_setPrototypeOf = Object.setPrototypeOf? Object.setPrototypeOf.bind(): function _setPrototypeOf(o, p) {o.__proto__ = p;return o;};return _setPrototypeOf(o, p);
}function _createSuper(Derived) {var hasNativeReflectConstruct = _isNativeReflectConstruct();return function _createSuperInternal() {var Super = _getPrototypeOf(Derived),result;if (hasNativeReflectConstruct) {var NewTarget = _getPrototypeOf(this).constructor;result = Reflect.construct(Super, arguments, NewTarget);} else {result = Super.apply(this, arguments);}return _possibleConstructorReturn(this, result);};
}function _possibleConstructorReturn(self, call) {if (call && (_typeof(call) === "object" || typeof call === "function")) {return call;} else if (call !== void 0) {throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);
}function _assertThisInitialized(self) {if (self === void 0) {throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;
}function _isNativeReflectConstruct() {if (typeof Reflect === "undefined" || !Reflect.construct) return false;if (Reflect.construct.sham) return false;if (typeof Proxy === "function") return true;try {Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));return true;} catch (e) {return false;}
}function _getPrototypeOf(o) {_getPrototypeOf = Object.setPrototypeOf? Object.getPrototypeOf.bind(): function _getPrototypeOf(o) {return o.__proto__ || Object.getPrototypeOf(o);};return _getPrototypeOf(o);
}function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}
}function _defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}
}function _createClass(Constructor, protoProps, staticProps) {if (protoProps) _defineProperties(Constructor.prototype, protoProps);if (staticProps) _defineProperties(Constructor, staticProps);Object.defineProperty(Constructor, "prototype", { writable: false });return Constructor;
}var Person = /*#__PURE__*/ (function () {function Person(name, age) {_classCallCheck(this, Person);this.name = name;this.age = age;}_createClass(Person,[{key: "running",value: function running() {}},{key: "eating",value: function eating() {}}],[{key: "randomPerson",value: function randomPerson() {}}]);return Person;
})();function inherit(SubType, SuperType) {SubType.prototype = Object.create(SuperType.prototype)SubType.prototype.constructor = SubType
}var Student = /*#__PURE__*/ (function (_Person) {_inherits(Student, _Person);var _super = _createSuper(Student);function Student(name, age, sno, score) {var _this;_classCallCheck(this, Student);_this = _super.call(this, name, age);_this.sno = sno;_this.score = score;return _this;}_createClass(Student,[{key: "studying",value: function studying() {}}],[{key: "randomStudent",value: function randomStudent() {}}]);return Student;
})(Person);var stu = new Student("why", 18, 111, 100);

四、多态

面向对象的三大特性:封装、继承、多态。

维基百科对多态的定义:多态(英语:polymorphism)指为不同数据类型的实体提供统一的接口,或使用一个单一的符号来表示多个不同的类型。

非常的抽象,个人的总结:不同的数据类型进行同一个操作,表现出不同的行为,就是多态的体现。

那么从上面的定义来看,JavaScript是一定存在多态的。

// 多态的表现: JS到处都是多态
function sum(a1, a2) {return a1 + a2
}sum(20, 30)
sum("abc", "cba")// 多态的表现
var foo = 123
foo = "Hello World"
console.log(foo.split())
foo = {running: function() {}
}
foo.running()
foo = []
console.log(foo.length)

相关文章:

JavaScript ES6类的定义与继承

文章目录 一、class方式定义类1.认识class定义类2.类和构造函数的异同3.类的构造函数4.类的实例方法5.类的访问器方法6.类的静态方法 二、继承1.extends实现继承2.super关键字3.继承内置类4.类的混入mixin 三、ES6转ES51.class转换2.extends转换 四、多态 一、class方式定义类 …...

中科芯与IAR共建生态合作,IAR集成开发环境全面支持CKS32系列MCU

中国上海–2023年10月18日–嵌入式开发软件和服务的全球领导者IAR今日宣布&#xff0c;与中科芯集成电路有限公司&#xff08;以下简称中科芯&#xff09;达成生态合作&#xff0c;IAR已全面支持CKS32系列MCU的应用开发。这一合作将进一步推动嵌入式系统的发展&#xff0c;并为…...

设计模式:外观模式(C#、JAVA、JavaScript、C++、Python、Go、PHP)

大家好&#xff01;本节主要介绍设计模式中的外观模式。 简介&#xff1a; 外观模式&#xff0c;它是一种设计模式&#xff0c;它为子系统中的一组接口提供一个统一的、简单的接口。这种模式主张按照描述和判断资料来评价课程&#xff0c;关键活动是在课程实施的全过程中进行…...

Leetcode—34.在排序数组中查找元素的第一个和最后一个位置【中等】

2023每日刷题&#xff08;六&#xff09; Leetcode—34.在排序数组中查找元素的第一个和最后一个位置 实现代码 /*** Note: The returned array must be malloced, assume caller calls free().*/ int lower_bound(int *arr, int numsSize, int target) {// 左闭右开区间[lef…...

Java 8 新特性 Ⅱ

方法引用 举例: Integer :: compare 理解: 可以看作是基于lambda表达式的进一步简化 当需要提供一个函数式接口的实例时, 可以使用lambda表达式提供实例 当满足一定条件下, 可以使用方法引用or构造器引用替换lambda表达式 实质: 方法引用作为函数式接口的实例 (注: 需要熟悉…...

C语言学习书籍推荐

C语言学习书籍推荐如下&#xff1a; 《C程序设计语言》&#xff08;The C Programming language&#xff09;&#xff1a;这本书由C语言创始人Brian W. Kernighan和Dennis M. Ritchie所写&#xff0c;是介绍标准C语言及其程序设计方法的权威性经典著作。《C陷阱与缺陷》&#…...

IntelliJ IDEA Maven加载超时问题

IDEA创建Maven项目遇到如下错误&#xff1a; Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:3.10.1 from/to central (Central Repository:): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/146.75.112.215] failed: conn…...

Spring中事务失效的几种场景及解决办法

未抛出异常&#xff1a;如果在一个带有事务的方法中没有抛出异常&#xff0c;Spring无法检测到事务失败&#xff0c;从而无法回滚。解决方法是确保在事务中遇到错误时抛出异常。 异常被捕获&#xff1a;如果在一个带有事务的方法中抛出异常&#xff0c;但被捕获并处理了&#…...

第五届太原理工大学程序设计竞赛新生赛(初赛)题解

第五届太原理工大学程序设计竞赛新生赛&#xff08;初赛&#xff09;题解 时隔半年重做一次&#xff0c;还是有几道不会&#xff0c;&#xff0c;&#xff0c;&#xff0c;&#xff0c; ⭐️A.饿饿饭饭 题目&#xff1a; &#x1f31f;题解&#xff1a; 很简单&#xff0c;签…...

微信小程序开发之后台数据交互及wxs应用

目录 一、后端准备 1. 应用配置 2. 数据源配置 二、数据库 1. 创建 2. 数据表 3. 数据测试 三、前端 1. 请求方法整合 2. 数据请求 3. WXS的使用 4. 样式美化 5. 页面 一、后端准备 通过SpringMVC及mybatis的技术学习&#xff0c;还有前后端分离的技术应用&…...

Java进阶篇--并发容器之ThreadLocal内存泄漏

目录 ThreadLocal内存泄漏的原因&#xff1f; 改进和优化 cleanSomeSlots方法 expungeStaleEntry方法 replaceStaleEntry方法 为什么使用弱引用&#xff1f; Thread.exit() ThreadLocal内存泄漏最佳解决方案 在使用完毕后立即清理ThreadLocal 使用InheritableThreadL…...

js实现红包雨功能(canvas,react,ts),包括图片不规则旋转、大小、转速、掉落速度控制、屏幕最大红包数量控制等功能

介绍 本文功能由canvas实现红包雨功能&#xff08;index.tsx&#xff09;本文为react的ts版。如有其他版本需求可评论区观赏地址&#xff0c;需过墙 import React, { Component } from react; // import ./index.css; import moneyx from /assets/images/RedEnvelopeRain/bal…...

【数字IC设计/FPGA】FIFO与流控机制

流控&#xff0c;简单来说就是控制数据流停止发送。常见的流控机制分为带内流控和带外流控。 FIFO的流水反压机制 一般来说&#xff0c;每一个fifo都有一个将满阈值afull_value&#xff08;almost full&#xff09;。当fifo内的数据量达到或超过afull_value时&#xff0c;将满…...

C++笔记之遍历vector的所有方式

C笔记之遍历vector的所有方式 —— 2023年4月15日 上海 code review 文章目录 C笔记之遍历vector的所有方式1.普通for循环2.迭代器版3.const迭代器4.C11引入的范围for循环5.使用auto关键字和迭代器6.使用std::for_each算法7.使用std::for_each和lambda表达式8.普通版vector::at…...

OpenCV 笔记(2):图像的属性以及像素相关的操作

Part11. 图像的属性 11.1 Mat 的主要属性 在前文中&#xff0c;我们大致了解了 Mat 的基本结构以及它的创建与赋值。接下来我们通过一个例子&#xff0c;来看看 Mat 所包含的常用属性。 先创建一个 3*4 的四通道的矩阵&#xff0c;并打印出其相关的属性&#xff0c;稍后会详细…...

基于指数分布优化的BP神经网络(分类应用) - 附代码

基于指数分布优化的BP神经网络&#xff08;分类应用&#xff09; - 附代码 文章目录 基于指数分布优化的BP神经网络&#xff08;分类应用&#xff09; - 附代码1.鸢尾花iris数据介绍2.数据集整理3.指数分布优化BP神经网络3.1 BP神经网络参数设置3.2 指数分布算法应用 4.测试结果…...

Python--练习:使用while循环求1~100之间,所有偶数的和(涉及if判断是不是偶数)

案例&#xff1a;求1~100之间&#xff0c;所有偶数的和 思考&#xff1a; 先套用原有基础模式&#xff0c;之后再思考其他的。 其实就是在之前文章 Python--练习&#xff1a;使用while循环求1..100的和-CSDN博客 的基础上&#xff0c;再判断如果获取到里面的全部偶数&#…...

带温度的softmax

用pytorch写一下使用带有温度的softmax的demo import torch import torch.nn.functional as F# 定义带有温度的softmax函数 def temperature_softmax(logits, temperature1.0):return F.softmax(logits / temperature, dim-1)# 输入logits logits torch.tensor([[1.0, 2.0, 3.…...

js函数调用的方式有几种

在 JavaScript 中&#xff0c;函数可以通过不同的方式进行调用。以下是常见的几种函数调用方式&#xff1a; 函数调用&#xff1a;使用函数名称后跟一对小括号来调用函数&#xff0c;这是最基本的调用方式。 functionName(); 方法调用&#xff1a;函数可以作为对象的方法进行调…...

聊聊设计模式--简单工厂模式

简单工厂模式 ​ 前面也学了很多各种微服务架构的组件&#xff0c;包括后续的服务部署、代码管理、Docker等技术&#xff0c;那么作为后端人员&#xff0c;最重要的任务还是代码编写能力&#xff0c;如何让你的代码写的漂亮、易扩展&#xff0c;让别人一看赏心悦目&#xff0c…...

告别笨重电脑!用SAP ITS Mobile + 条码枪搞定仓库盘点(附PDA分页代码)

工业级移动化实战&#xff1a;SAP ITS Mobile在仓储场景的深度优化指南 在嘈杂的仓库环境中&#xff0c;操作员手持工业PDA完成物料扫描时&#xff0c;设备突然卡顿或界面元素错位——这种场景对SAP移动化方案的稳定性提出了严苛要求。传统PC端SAP界面直接迁移到移动设备往往导…...

告别联网依赖:一份完整的Zsh Oh My Zsh离线安装包制作与部署方案

企业级终端环境部署&#xff1a;Zsh与Oh My Zsh离线化解决方案全景指南 在服务器集群与开发环境管理中&#xff0c;终端工具的标准化配置往往成为团队效率的隐形分水岭。当数百台服务器因安全策略限制无法连接外网时&#xff0c;如何实现Zsh及其生态组件的批量部署&#xff1f;…...

重返未来1999自动化助手M9A:如何轻松解放双手的终极指南

重返未来1999自动化助手M9A&#xff1a;如何轻松解放双手的终极指南 【免费下载链接】M9A 重返未来&#xff1a;1999 小助手 | Assistant For Reverse: 1999 项目地址: https://gitcode.com/gh_mirrors/m9/M9A 厌倦了在《重返未来&#xff1a;1999》中重复刷取材料、完成…...

TouchGal完整指南:3步打造你的专属Galgame文化社区

TouchGal完整指南&#xff1a;3步打造你的专属Galgame文化社区 【免费下载链接】kun-touchgal-next TouchGAL是立足于分享快乐的一站式Galgame文化社区, 为Gal爱好者提供一片净土! 项目地址: https://gitcode.com/gh_mirrors/ku/kun-touchgal-next TouchGal是一个专为Ga…...

漫画翻译革命:如何用BallonsTranslator让外文漫画阅读零门槛?

漫画翻译革命&#xff1a;如何用BallonsTranslator让外文漫画阅读零门槛&#xff1f; 【免费下载链接】BallonsTranslator 深度学习辅助漫画翻译工具, 支持一键机翻和简单的图像/文本编辑 | Yet another computer-aided comic/manga translation tool powered by deeplearning …...

三步彻底解决惠普OMEN游戏本性能限制:OmenSuperHub终极方案实践指南

三步彻底解决惠普OMEN游戏本性能限制&#xff1a;OmenSuperHub终极方案实践指南 【免费下载链接】OmenSuperHub 使用 WMI BIOS控制性能和风扇速度&#xff0c;自动解除DB功耗限制。 项目地址: https://gitcode.com/gh_mirrors/om/OmenSuperHub 对于追求极致性能的惠普OM…...

AI时代生存指南:如何化焦虑为行动,小白程序员必备(收藏版)

文章指出&#xff0c;互联网大厂员工中&#xff0c;非AI岗位人员比AI从业者更焦虑&#xff0c;因为他们的工作易被AI替代。正确看待AI焦虑需避免两个认知陷阱&#xff1a;一是忽视变化&#xff0c;二是信息焦虑导致行动瘫痪。破局思路包括&#xff1a;1&#xff09;大量使用AI工…...

Google I/O Pinball物理引擎实现:Flame与Forge2D的完美结合

Google I/O Pinball物理引擎实现&#xff1a;Flame与Forge2D的完美结合 【免费下载链接】pinball Google I/O 2022 Pinball game built with Flutter and Firebase 项目地址: https://gitcode.com/gh_mirrors/pi/pinball Google I/O 2022 Pinball游戏是一个使用Flutter和…...

从温控到小车:深入浅出聊聊PID里I(积分)和D(微分)到底管啥用?

从温控到小车&#xff1a;深入浅出聊聊PID里I&#xff08;积分&#xff09;和D&#xff08;微分&#xff09;到底管啥用&#xff1f; 想象一下&#xff0c;你正在用热水器调节洗澡水温。把旋钮拧到"38℃"位置后&#xff0c;水温却始终在36℃徘徊——这种永远差一点的…...

S32K144 MCAL 4.2.1 环境搭建避坑全记录:从EB Tresos Studio到GCC 6.3.1的保姆级教程

S32K144 MCAL 4.2.1 环境搭建实战指南&#xff1a;从零开始构建AutoSAR开发环境 第一次接触S32K144的AutoSAR MCAL开发环境搭建时&#xff0c;我花了整整三天时间才让第一个例程成功运行。这期间经历了License激活失败、GCC版本冲突、路径配置错误等一系列问题。本文将把这些踩…...