当前位置:网站首页>private package
private package
2022-08-05 02:44:00 【black and white impure】
1. Encapsulation is to hide as many properties and methods in a class as possible, so that external programs cannot directly access them, but indirectly access them through the provided public methods.
2. Steps of encapsulating implementation
1) Use private to modify attributes and methods
2) Provide public getXxx()/setXxx() methods
3) In getXxx()/setXxx() methodsJudgment on the data
3. What are the access modifiers for classes and their scopes
Public: Shared access level, can be accessed anywhere
Default modifier: Package-level private, accessible within the same package
4. Access modifiers for class members
public, protected, default modifier, private
边栏推荐
猜你喜欢
随机推荐
QT MV\MVC结构
[LeetCode Brush Questions] - Sum of Numbers topic (more topics to be added)
多线程(2)
matlab绘制用颜色表示模值大小的箭头图
627. 变更性别
语法基础(变量、输入输出、表达式与顺序语句完成情况)
C学生管理系统 指定位置插入学生节点
PostgreSQL数据库 用navicat 打开表结构的时候报错 cannot update secondarysnapshot during a parallel operation 怎么解决?
QStyle平台风格
协作D2D局部模型聚合的半分散联合学习
DAY22: sqli-labs shooting range clearance wp (Less01~~Less20)
OpenGL 工作原理
Review 51 MCU
C language implements a simple number guessing game
[C language] Detailed explanation of stacks and queues (define, destroy, and data operations)
Unleashing the engine of technological innovation, Intel joins hands with ecological partners to promote the vigorous development of smart retail
1527. 患某种疾病的患者
力扣-二叉树的最大的深度
VSCode Change Default Terminal 如何修改vscode的默认terminal
RAID disk array