面向对象的三个基本特征
Posted yun---meng
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了面向对象的三个基本特征相关的知识,希望对你有一定的参考价值。
面向对象三大特性:封装、继承、多态
封装:将类的某些信息隐藏在类内部,不允许外部程序直接访问,而是通过该类提供的方法来实现对隐藏信息的操作和访问
继承:{关键字 --- extends}子类继承父类的特征和行为,子类可以使用父类的方法和属性,还可以重写父类的方法
多态是指子类对象可以直接赋给父类变量(父类引用指向子类对象),但运行时依然表现出子类的行为特征,也就是说,同一类型的对象在执行同一个方法时,可能表现出多种行为特征。
!--5f39ae17-8c62-4a45-bc43-b32064c9388a:W3siYmxvY2tJZCI6IjU5MzQtMTU4NTg5ODUzMDE0MiIsImJsb2NrVHlwZSI6InBhcmFncmFwaCIsInN0eWxlcyI6eyJhbGlnbiI6ImxlZnQiLCJpbmRlbnQiOjAsInRleHQtaW5kZW50IjowLCJsaW5lLWhlaWdodCI6MS43NSwiYmFjay1jb2xvciI6IiIsInBhZGRpbmciOiIifSwidHlwZSI6InBhcmFncmFwaCIsInJpY2hUZXh0Ijp7ImRhdGEiOlt7ImNoYXIiOiLpnaIifSx7ImNoYXIiOiLlkJEifSx7ImNoYXIiOiLlr7kifSx7ImNoYXIiOiLosaEifSx7ImNoYXIiOiLkuIkifSx7ImNoYXIiOiLlpKcifSx7ImNoYXIiOiLnibkifSx7ImNoYXIiOiLmgKcifSx7ImNoYXIiOiLvvJoifSx7ImNoYXIiOiLlsIEifSx7ImNoYXIiOiLoo4UifSx7ImNoYXIiOiLjgIEifSx7ImNoYXIiOiLnu6cifSx7ImNoYXIiOiLmib8ifSx7ImNoYXIiOiLjgIEifSx7ImNoYXIiOiLlpJoifSx7ImNoYXIiOiLmgIEifV0sImlzUmljaFRleHQiOnRydWUsImtlZXBMaW5lQnJlYWsiOnRydWV9fV0=-->!--5f39ae17-8c62-4a45-bc43-b32064c9388a:W3siYmxvY2tJZCI6IjE1MjAtMTU4NTkwMTQ3MzY4NiIsImJs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5rOVIn0seyJjaGFyIjoi5ZKMIn0seyJjaGFyIjoi5bGeIn0seyJjaGFyIjoi5oCnIn0seyJjaGFyIjoiLCJ9LHsiY2hhciI6Iui/mCJ9LHsiY2hhciI6IuWPryJ9LHsiY2hhciI6IuS7pSJ9LHsiY2hhciI6IumHjSJ9LHsiY2hhciI6IuWGmSJ9LHsiY2hhciI6IueItiJ9LHsiY2hhciI6IuexuyJ9LHsiY2hhciI6IueahCJ9LHsiY2hhciI6IuaWuSJ9LHsiY2hhciI6IuazlSJ9XSwiaXNSaWNoVGV4dCI6dHJ1ZSwia2VlcExpbmVCcmVhayI6dHJ1ZX19XQ==-->以上是关于面向对象的三个基本特征的主要内容,如果未能解决你的问题,请参考以下文章
面向对象的三个基本特征
面向对象的三个基本特征
面向对象的三个基本特征
面向对象的三个基本特征
面向对象的三个基本特征 和 五种设计原则
面向对象的三个基本特征(转载)