2012年12月10日星期一

Overriding private methods in Java wow po o1

Overriding private methods in JavaGiving a member function the private access privilege modifier means that this function can only be called by its declaring class, not by others (not even the derived classes). When you declare a private member function as virtual, even pure virtual (virtual void foo() = 0;), you allow the base class to benefit from specialization while still enforcing the access privileges wow gold.When it comes to virtual member functions, access privileges tells you what you are supposed to do:private virtual means that you are allowed to specialize the behavior but the invocation of the member function is made by the base class, surely in a controlled fashionprotected virtual means that you should / must invoke the upper class version of the member function when overriding itSo, in C++ Acheter Des PO, access privilege and virtualness are independent of each other. Bill Jan 4 '10 at 23:00Because encapsulation has to do with behavior and not implementation details, private methods have nothing to do with the idea encapsulation. In a sense, your question makes no sense wow po. It's like asking "How is putting cream in coffee not a violation of encapsulation?"
More articles come from the:http://www.wowgoldpo.fr

没有评论:

发表评论