学习笔记3.docx
《学习笔记3.docx》由会员分享,可在线阅读,更多相关《学习笔记3.docx(22页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、精品名师归纳总结资料word 精心总结归纳 - - - - - - - - - - - -学习好资料欢迎下载孙鑫 vc+学习笔记( Sun Xin vc+ learning notes)1. about creating window applicationsUnderstand the capabilities of the windows program, the API function, the relationship between the message queue and the operating system, the input and output devicesWin
2、dow programming, sub background and front deskFront desk for what kind of window, how to display the title, and the destruction of the window, the day after tomorrow continue to runBackground is the design purpose, he is through the window message queue continuous access to messages GetMessage and t
3、ranslation, that is, the winprocess function of the subfunctiontocallcallbackfunctiontoachieve,writtenby the user himselfMessages are implemented through applications that providefunctionstothe system platformtotunetheeffectsof hardware, sound, orimages.Applicationsare builton applicationsystemsThe
4、concrete steps are as followsThe construction of new Win32 Application source program written in empty project file with C program source file that contains the windows.h file to the WinMain function to writeitcontainsthemain functionofthisprogram withthefunction of DOS under the same entrance when
5、the application ends its WinMain function at the end is called by the operating system可编辑资料 - - - 欢迎下载精品名师归纳总结学习资料 名师精选 - - - - - - - - - -第 1 页,共 11 页 - - - - - - - - - -可编辑资料 - - - 欢迎下载精品名师归纳总结资料word 精心总结归纳 - - - - - - - - - - - -学习好资料欢迎下载allocates space assignmentThe program designincludes:thedef
6、initionofWinMain function to create a window to create a message loop write windowprocedure four step window: design a window class fill in the blank window display status includes cursor display background loading icon loadicon window function lpfnWndProc messageresponse functionby itsownoperatings
7、ystem,but need towrite code to call registered window class Registerclass to createa window createWindow window size coordinate menu handle and update updateWindow ShowWindow display window of eachfunctiontypeoperatingsystem isbasicallyfixedagaintoset a messageloopwhileGetMessage correspondingtothem
8、essage size and member variables the corresponding applicationmessage queue to achieve continuous operation program background TranslateMessage converted to wchar The distribution dispatchmessage to the middle layer of the callback function for operating system the last messageeditingwindow function
9、switchprocesstodealwiththemouse button to destroy the window and the end of the news programplusdefaultprompt:thesystem isthroughthewindow functionaddress pointer to invoke the process window function 2, about c+C+ has more advantages over C, mainly in encapsulation, inheritance and polymorphismSele
10、ct new project Win32 console application c+ source filewritteninstructurec+ body can writefunctionofforeignbody and thestructurecan callthemembervariablec+ functionin可编辑资料 - - - 欢迎下载精品名师归纳总结学习资料 名师精选 - - - - - - - - - -第 2 页,共 11 页 - - - - - - - - - -可编辑资料 - - - 欢迎下载精品名师归纳总结资料word 精心总结归纳 - - - - - -
11、 - - - - - -学习好资料欢迎下载similarbutby defaulttothemembervariableaccessisnotthe sameAn instance of a class and object instantiated with an object that defines a structure variable is to produce an objectConstructor: the important function is to create the object itself, and each object must have a constr
12、uctor that has the same form as the class name and has no return value,In a statement object will automatically call the default constructor is a constructor with no parameters are only responsible for creating object not initialized if the definition of a parameter or a zeroary constructor, c+ will
13、 not create a default constructorDestructor:theobjectisresponsibleforretrievingitsmemory space at the end of the objects life. In contrast to theconstructor, the arguments and return values are not allowed,and a class can only have one destructor.Overloading of functions: if the constructor overload
14、s, c+ automaticallymatches the calltothecorrespondingfunction, overloading the condition: the parameter type of the functionand the number of argumentsThis pointer: an implicit pointer to an object corresponding to itself, representing the address of the object this=&pt.Thismakes it easy towritethem
15、embervariablesintheobjectusing VCs automatic listing of member functions, using this 可编辑资料 - - - 欢迎下载精品名师归纳总结学习资料 名师精选 - - - - - - - - - -第 3 页,共 11 页 - - - - - - - - - -可编辑资料 - - - 欢迎下载精品名师归纳总结资料word 精心总结归纳 - - - - - - - - - - - -学习好资料欢迎下载Base classinheritanceand access characteristicsofthethree ki
16、ndsofsubclassestoinheritfathertosee thedefinitionof property inheritance characteristics and the parent class memberfunctiondecision,protectedinsubclassingbutoutside such as fish.breath main in the function cannot be calledby the fish class but can not be inherited visit the subclass inheritance, if
17、 the parent class with parameters, the subclass inheritance should also add parameters, the constructor callthe parent class and subclass, and the destructor calls in reverse orderOverlayoffunctions:a membervariablethatoccursbetween the two classes of a parent class and a subclass. The name of thefu
18、nctionisconsistent.Scope identifier:used toindicate which class of member variables the function belongs to andprevents the coverage of the member functions of the parent classPolymorphism: virtual in the base class member function, sub class inheritance, VC sub class visit, sub class has a member f
19、unction with the same name is called sub classes, subclassesdidnotcalltheparentclass.Another:purevirtualfunctions appear inbase classes,butareimplementedby derivedclassesReference and pointer: int a=5; int &b=a; a, B, point to thesamememoryspace atthesametime,AB isan aliaspointer,and the variable it
20、self occupies memory, which stores the contentas the address pointing to the variableFor write method of.Cpp file and.H file, create different files可编辑资料 - - - 欢迎下载精品名师归纳总结学习资料 名师精选 - - - - - - - - - -第 4 页,共 11 页 - - - - - - - - - -可编辑资料 - - - 欢迎下载精品名师归纳总结资料word 精心总结归纳 - - - - - - - - - - - -学习好资料欢
21、迎下载in the open the project can also be found in the project file new text file later renamed F2, VC function keys to add one to write different engineering documentsVC program to compile and link mechanism: precompiled , and when the project file is established to find the solutionto the project fil
22、e, header file contains repeated problems:#ifdef XX #define XX preparation after adding ENDIF, repeat this definition can prevent the error, prevent the VC compilation process mechanism integration: the pre processorto the pre compiled instruction compiler # to project source code .Cpp separately co
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 学习笔记 学习 笔记
限制150内