摘要:
Note: This article has been written with the assistance of AI. 普通类 (Regular Class) 类的定义和基本结构 类的定义语法 [访问修饰符] class 类名 [extends 父类] [implements 接口1, 接口2 阅读全文
posted @ 2025-09-29 17:48
Charlie_Byte
阅读(29)
评论(0)
推荐(0)
摘要:
Note: This article has been written with the assistance of AI. 单一职责原则(SRP) 一个类应该只有一个引起它变化的原因。 通俗地讲,就是一个类只负责一项职责或功能。不要设计“万能”类,把不相关的功能塞在一起。如果一个类承担了太多的职责 阅读全文
posted @ 2025-09-29 12:17
Charlie_Byte
阅读(9)
评论(0)
推荐(0)
摘要:
Note: This article has been written with the assistance of AI. 多态的体现 多态是面向对象编程的三大特性之一,允许不同类的对象对同一消息做出响应,提高了代码的灵活性和可扩展性。 方法重载 方法重载是指同一类中可以有多个同名方法,方法签名是 阅读全文
posted @ 2025-09-29 11:20
Charlie_Byte
阅读(11)
评论(0)
推荐(0)

浙公网安备 33010602011771号