OOP 四大支柱
- 封装
- 抽象
- 继承
- 抽象
类的抽象就是对现实对象的一种模拟,但是只是根据需要模拟部分属性和方法;
封装的目的就是把一些信息隐藏起来,只暴露部分内容给其他对象,类中用private来实现;
封装+抽象是接口和抽象类的基础,有了它们接口和抽象才能顺理成章;
接口就是类中public部分。
OOP 四大支柱
类的抽象就是对现实对象的一种模拟,但是只是根据需要模拟部分属性和方法;
封装的目的就是把一些信息隐藏起来,只暴露部分内容给其他对象,类中用private来实现;
封装+抽象是接口和抽象类的基础,有了它们接口和抽象才能顺理成章;
接口就是类中public部分。