In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the knowledge of "the use of Virtual in C++". Many people will encounter this dilemma in the operation of actual cases. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Virtual is a very important keyword in C++ OO mechanism. Anyone who has studied C++ knows that the function with the Virtual keyword added to the class Base is a virtual function (for example, the function print), so the base class virtual function can be overridden by rewriting the virtual function in the derived class Derived of Base. When the pointer point of the base class Base points to the object of the derived class Derived, the call to the print function of point is actually calling the print function of Derived instead of the print function of Base. This is the embodiment of polymorphism in object-oriented. (for information on how the virtual mechanism is implemented, see Inside the C++ Object Model, Addison Wesley 1996)
Class Base
{
Public:Base () {}
Public:
Virtual void print () {cout
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.