谢谢 Marcelo PintoAdding to the OP''s question:_____| c1 | virtual void a() = 0;|_____| vritual void b() = 0;^___|_____|__ __|__implements b | c2 | | c3 | both implements avirtual void b();|_____| |_____| virtual void a();^___|______|__ __|__| c4 | | c5 | NOT supposed to REimplement a|_____| |_____| both implement bIf I have the situation shown above, is there a way to prevent theimplementers of classes derived from c3 (c4 and c5 in the diagram) toaccidentally reimplement method a? By a way I mean a compiler errorlike the one I suppose is shown in Java when one tries to reimplementa method declared as final.ThanksMarcelo Pinto 这篇关于如何在C ++中实现final的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 02:50