摘要
继承是面向对象程序设计方法学中重要的机制。采用继承机制来组织和设计类,可以提高程序的抽象程度,使之更接近与人类的自然思维。研究了继承的特点,通过程序实例,进行对比分析,探讨了C++语言中由继承带来的属性的隐藏和方法的覆盖、遮蔽等重要性质,得出使用继承不仅可以使得大量的代码可以复用,而且可以大大减少代码和数据的冗余度,同时由方法的覆盖可以实现真正意义上的多态,并由此使得程序具有更好的扩展性。
Inheritance is an important mechanism of object-oriented programming methodology. Using the inheritance mechanism to organize and design classes, the program can improve the level of abstraction, making it more close to the nature of human thought. It studies the inheritance of characteristics in C ++ language, brought by the succession of the hidden properties and methods of coverage, shelter and other important properties by instances, comparative analysis. The results show that using the inheritance not only can make a lot of code reuse, but also can significantly reduce the redundancy of code and data, while the coverage can be achieved by the method of truly multi-state, and thus makes the application more scalability.
出处
《电子设计工程》
2011年第8期29-31,37,共4页
Electronic Design Engineering