本文介绍了这行代码意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 大家好, 我有一些我无法理解的代码。你能否请 帮忙? int _tmain(int argc,_TCHAR * argv []) { //初始化COM环境。 ccLib :: CCoInitialize CoInitialize(ccLib :: CCoInitialize :: eMTAModel); .... } 1. CCoInitialize是一个类 来调用你写的课程对象 CCoInitialize cc; 2. CoInitialize是静态函数。 调用静态函数你编写范围分辨率::" ccLib :: CCoInitialize :: CoInitialize(ccLib :: CCoIniti alize :: eMTAModel); 当他们有空格时而不是::那什么意识?他们试图做什么 ? 谢谢 Trups 解决方案 我认为ccLib是一个命名空间,该行意味着实例化在命名空间ccLib中定义的类CCoInitialize。 7月11日上午11点07分,Hooyoo< zhao_huy ... @ 126.com写道: 我认为ccLib是一个命名空间,该行意味着实例化 类在命名空间ccLib中定义的CCoInitialize.-隐藏引用文本 - - 显示引用文本 - 感谢您的回答。是的ccLib是一个名称空间。我还有一个 问题 CoInitialize(ccLib :: CCoInitialize :: eMTAModel);返回HRESLT所以这个 函数应该是 HRESULT result = CoInitialize(ccLib :: CCoInitialize :: eMTAModel); 和ccLib :: CCoInitialize cclib;这应该是实例化 你把两者结合起来是什么意思? ccLib :: CCoInitialize CoInitialize(ccLib :: CCoInitialize :: eMTAModel); 那个空间(CCoInitialize CoInitialize)我很困惑。 谢谢 那不是std C ++。什么是_tmain?什么是_TCHAR *? 我们假设这是一个初始化,因为你的评论说 所以。 (顺便说一句,因为你还没有给出任何关于eMTAModel的内容, 这个表达式很可能被视为一个函数声明 ) 没有像space而不是::这样的通用规则在 your_specific_example中,声明并初始化的第一个语句 ''CoInitialize''作为类ccLib :: CCoInitialize的对象。 秒语句调用了 的CoInitialize静态成员函数ccLib :: CCoInitialize类。 Hi all,I have some code that I am unable to understand. Can you pleasehelp?int _tmain(int argc, _TCHAR* argv[]){// Initialize COM environment.ccLib::CCoInitialize CoInitialize(ccLib::CCoInitialize::eMTAModel);....}1. CCoInitialize is a classto invoke a object of class you writeCCoInitialize cc;2. CoInitialize is static function.to invoke static function you write scope resolution "::"ccLib::CCoInitialize::CoInitialize(ccLib::CCoIniti alize::eMTAModel);when they have "space" instead of "::" what is that mean? What arethey trying to do?ThanksTrups 解决方案I think ccLib is a namespace, and that line means to instantiateclass CCoInitialize that is defined in namespace ccLib.I think ccLib is a namespace, and that line means to instantiateclass CCoInitialize that is defined in namespace ccLib.- Hide quoted text -- Show quoted text -Thanks for your answer. Yes ccLib is a namespace. I still have aquestionCoInitialize(ccLib::CCoInitialize::eMTAModel); returns HRESLT so thisfunction should beHRESULT result = CoInitialize(ccLib::CCoInitialize::eMTAModel);and ccLib::CCoInitialize cclib; this should be instantiationwhat do you mean when you combine both?ccLib::CCoInitialize CoInitialize(ccLib::CCoInitialize::eMTAModel);That space (CCoInitialize CoInitialize) I am confuse with.ThanksThats not std C++. what is _tmain? what is _TCHAR* ?Let us assume that this is an initialization since your comments sayso. (BTW, since you have not given any context of what eMTAModel is,this expression could very well be treated as a function declarationalso)There is no general rule like "spaces instead of ::" etc. Inyour_specific_example, the first statement declared and initialized''CoInitialize'' as an object of the class ccLib::CCoInitialize. Thesecond statement invoked the CoInitialize static member function ofthe class ccLib::CCoInitialize. 这篇关于这行代码意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-01 17:48