In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article shows you how to correctly understand the C++ framework, the content is concise and easy to understand, absolutely can make your eyes shine, through the detailed introduction of this article I hope you can gain something.
C++ programming language, there are many more important content worthy of our in-depth study. Understanding these basics not only helps us master C++, but also helps us learn other languages more or less.
In English it is called Framework. An application framework is called an Application Framework. You haven't heard of frameworks, but you've definitely heard of the term. Net framework. Otherwise Microsoft's advertising is too watery. Of course,. net framework is for. net, in fact, mainly C#to do, many students said, C++ can also ah, C++ with CLR can be, but C++ with CLR or C++, and since the CLR is used, why not simply use C#? But this is just by the way, because I have not studied CLR, nor have I used C++ under CLR, no research, no right to speak. Let's talk about the C++ framework.
First of all, it should be clear that without framework, can we do development and application? Think it's okay. When there is no framework, we call the function directly to complete the function. just simple。
Then what is the difference between no framework and framework? *** The difference is that when there is no framework, we call the function, and when there is framework, it is the framework that calls us.
Compared with the old C++ framework, it should be MFC, MFC's full name is Microsoft Foundation Class, which is Microsoft Foundation Class Library, isn't it still a class library? I don't think there's any mention of framework. However, if you look closely at the functions inside, you can see that many functions have the prefix Afx, Af, which is the Application Framework.
The STL of C++ is called Standard Template Library. Is it a C++ framework? Let's look at what it provides. It provides string classes, input and output streams, various data structures, and algorithms. These are all things that we call into our programs to do things, and from my point of view, it's not a framework, it's just a library.
Why is MFC a C++ framework? First mention MFC, what comes to mind. It should be the interface. MFC provides controls including static,editbox,button,radio,list,tree, etc., but is it just an interface? When we click the button, it performs the action. There are also functions bound to it. At the same time, we write, for example, a MessageBox in the corresponding function, which will be executed at that time and display this message box. All this is done inside MFC, all we need to do is drag a button over, add the corresponding Buttonclick event, and then add the corresponding implementation to the corresponding function.
The original framework is that before we write our software, the entire execution process is specified for us, we fill in the blanks at the specified points, and then we can complete the application. For example, I wrote a software in 2009, but MFC was completed in 2000 (actually not ha, just an example). How does it know what I'm going to do, and then call these functions that I wrote, and finally complete the function.
In fact, now generally to implement the framework, are using object-oriented technology, that is, we often hear, listen to the ears are born cocoon, in fact, there is not too clear run-time binding, that is, object-oriented encapsulation, inheritance, polymorphic behavior. But MFC at that time, due to performance reasons, with virtual function is relatively small, mainly with macro (in Hou Jie teacher's book called macro, in fact, is a thing) to complete, but still a lot of places to use virtual function. Let's look at MFC to understand the specific principles.
As a framework, you only need to define a superclass, and then when you need to implement it, inherit this superclass, whether it is a class, abstract class or interface, and then implement it, so that the framework does not need to know you, it only needs to know the superclass to run. And it's calling you.
In fact, I thought about it these two days. In addition to object-oriented, we use callback functions in C system. In fact, they are function pointers. Isn't it also used to let others call and realize the called part by themselves? Oh, and that's what's often referred to as inversion of control (or dependence inversion)? However, in the C and C++ worlds, these terms are mentioned less often and are not connected at once.
However MFC accomplished a lot of things, windows message encapsulation, message mapping and message routing is part of it, but it also provides CString and other classes for us to use, but also provides Document-View, but also provides serialization and so on.
Another well-known C++ framework, as if there is a heavyweight network development framework called ACE, but did not understand, just know that there is such a thing.
Linux is not a framework, from the current Linux driver development, the use of modules to develop perspective, it seems that this set can be considered a framework, as long as the registration of the module, then it knows, can also be called.
In addition, software with plug-in mechanism is not considered a framework?
I know there are plug-in mechanism software, the older Winamp, firefox now, and thunderbird Mozilla out of the series of software, eclipse, etc., these eclipse is definitely a framework, what about others?
In addition, in C++, Qt, wXwidget, etc., although not used, but should also be regarded as C++ framework, and is cross-platform.
Write something, but more chaotic, and may not express some of the meaning clearly, free I can also re-organize, the problem is very big, for the framework, there are many to learn. The model has not been learned well, nor can it be negotiated well.
This is how C++ frameworks should be understood correctly. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserves, please pay attention to the industry information channel.
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.