freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

計(jì)算機(jī)外文資料翻譯--隱蔽方法在c++-其他專業(yè)-文庫吧

2025-12-16 02:21 本頁面


【正文】 的子類必須創(chuàng)建一個(gè)具體的工廠函數(shù),而不是編寫新的。這家工廠功能檢查是否函數(shù) f()重寫。如果不是,它創(chuàng)建一類的新實(shí)例,否則會(huì)發(fā)出編譯時(shí)錯(cuò)誤消息和編譯失敗。實(shí)現(xiàn)為此,我們有私人經(jīng)營的新定義在類,并宣布為朋友的工廠函數(shù)。我們需 要一個(gè)輔助類,它描述了成員功能作出最后。見下文: template class C, void (C::*p)() class Helper { }。 第一個(gè)模板參數(shù)是一個(gè)任意類型,第二個(gè)一個(gè)是適當(dāng)?shù)某蓡T函數(shù)的指針。模板class T結(jié)構(gòu)的最終檢查 T類是否有不同的成員函數(shù) f一 :: f()的方法如下: template class T struct Final { Final() { const bool b = boost::is_same HelperA, amp。A::f, HelperA, amp。T::f ::value。 BOOST_MPL_ASSERT_MSG( b, ERROR_INVALID_OVERRIDE_OF_FUNCTION, (void) )。 } }。 原 理功能是相同的 [10] boost庫提供,而且它的兩個(gè)模板參數(shù)在編譯時(shí)檢查是否是相同的。宏升壓的 MPL的 ASSERT味精 [10]創(chuàng)建一個(gè)編譯時(shí)錯(cuò)誤消息時(shí),它的第一個(gè)參數(shù)是假的。第二個(gè)參數(shù)是錯(cuò)誤信息,第三個(gè)擁有某種類型的信息,這是不有必要在這里。如果 T是 A和子類的成員函數(shù) f不是 overidden在 T,則 T:: f是相同的 成員功能,從而為 A:: F兩個(gè)輔助類有相同的類型。工廠的功能如下: templatetypename T T* factory() { FinalT()。 T* t = new T()。 return t。 } 如果它可以創(chuàng)建臨時(shí)最終 T對(duì)象,這意味著該成員函數(shù) f是不被覆蓋。否則最終構(gòu)造的Boost MPL的斷言味精導(dǎo)致一個(gè)編譯錯(cuò)誤。這些源代碼的大部分是由預(yù)處理產(chǎn)生宏在下列方式: 結(jié)構(gòu) A struct A { virtual void f() {} PREPARE_FINAL_METHODS }。 SET_FINAL(A, f, void, ())SET_FINAL( A, F,無效的,()) 宏準(zhǔn)備 final方法產(chǎn)生的私人運(yùn)營商新功能的朋友聲明工廠。宏集最終( A, F,無效的,())作為最后一個(gè)成員函數(shù)的成員函數(shù) f。宏的第一個(gè)參數(shù)是類,第二個(gè)是功能,第三個(gè)什么返回類型,而最后一個(gè)是參數(shù)類型列表。我們提供集 FINALn預(yù)處理宏定義多個(gè)成員函數(shù)到:最后更新, N表示成員函數(shù)設(shè)置到最后這個(gè)宏有四個(gè)參數(shù)列印倍。(四,每個(gè)成員函數(shù)想在前面的例子。)下面的例子顯示了這個(gè)復(fù)雜的用法 解決方案: struct A { virtual void f() { /* ... */ } virtual int g(int, double) { /* ... */ } virtual char h() { /* ... */ } virtual void k() { /* ... */ } PREPARE_FINAL_METHODS }。 SET_FINAL3(A, f, void, (), A, g, int, (int, double), A, h, char, () ) struct B : A { int g(int, double) { /* ... */ } }。 struct C : A { void k() { /* ... */ } }。 int main() { B* b = factoryB()。 // ERROR C* c = factoryC()。 // OK } 設(shè)置 FINAL3宏創(chuàng)建的具體幫手最終類和工廠功能的成員函數(shù) F, G和 ?,我們當(dāng)前要設(shè)定最后更新。該結(jié)構(gòu)乙覆蓋結(jié)構(gòu)的一個(gè)成員函數(shù) ?和結(jié)構(gòu) 231。也與成員函數(shù) K表相同。當(dāng)我們當(dāng)前要?jiǎng)?chuàng)建一個(gè)乙的實(shí)例,我們得到以下錯(cuò)誤消息: assertion_failed(mpl_::failed************ (FinalR::Final() [with R = C]:: ERROR_INVALID_OVERRIDE_OF_FUNCTION ::************) 出現(xiàn)此錯(cuò)誤信息,因?yàn)榻Y(jié)構(gòu)乙覆蓋其基類一個(gè) Hovewer 至少有一個(gè)最后更新的成員函數(shù)成員,因?yàn)槲覀儺?dāng)前可以建立一個(gè)實(shí)例結(jié)構(gòu) 231。?是不是最終的功能。 在本文中,我們提出了不同的實(shí)現(xiàn)面向?qū)ο蟮奶匦栽诘?C ++不提供局域網(wǎng)有瓜葛的構(gòu)造。這些功能使開發(fā)變得更容易,更安全,更靈活。 final 類的想法來從 Java 和其實(shí)施的 C + +的優(yōu)勢(shì)模板。 unhidable 方法的想法來自一個(gè)常見的錯(cuò)誤時(shí),繼承和重載。該解決方案還采用了 C + +模板的構(gòu)建。定義的最后一個(gè)成員函數(shù)是既有益設(shè)計(jì)和效率的原因。雖然 C + +編程語言不支持它本身,我們提出如何 運(yùn)用這個(gè)面向?qū)ο蟮奶攸c(diǎn),在解決方案的 C + +。在當(dāng)前的研究與開發(fā)階段是有限制設(shè)置成員函數(shù)作為最后:如果有一個(gè)成員設(shè)置為最終沒有基類中的函數(shù)( F)允許創(chuàng)建一個(gè)派生類的成員函數(shù) f 即使有不同的參數(shù)類型。我們今后的工作是提高我們的解決方案,以消除此限制。 附件 2:外文原文 (復(fù)印件) Subtle Methods in C++ Vol. 11, No. 3, 2021, 11–16, DOI: SUBTLE METHODS IN C++ Zala180。n SZU? GYI, Norbert PATAKI, Jo180。zsef MIHALICZA Department of Programming Languages and Compilers, E168。otv168。os Lor180。and University, P180。azm180。any P180。eter s180。et180。any 1/C, H1117 Budapest, Hungary, , , ABSTRACT: Nowadays plex software systems are designed and implemented with the help of the objectoriented paradigm principally. However, objectoriented languages support the objectoriented paradigm in different ways with different constructs. C++ has a sophisticated inheritance notation based on access modifiers. C++ distinguishes virtual, pure virtual and nonvirtual methods. Java uses final classes and methods to disable inheritance. However, Java does not support multiple inheritance. Eiffel allows renaming inherited methods. In this paper we present some method utilities for C++ to create safer and more flexible objectoriented systems. We present how the method renaming can be implemented. We developed constructs to create final and unhittable methods. These constructs are implemented with the help of C++ template facilities. We present scenarios where one can write safer code with our constructs. Keywords: C++, methods, objectoriented programming, template 1. INTRODUCTION Objectoriented programming (OOP) is still the most mon programming paradigm. It represents an attempt to make programs more closely model the way people think about and deal with the world. In the older styles of programming, a programmer who is faced with some problem must identify a puting task that needs to be performed in order to solve the problem. In this way, programming consists of finding a sequence of instructions that will acplish that task. In the objectoriented realm instead of tasks we find objects entities that have behaviors, that hold information, and that can interact with one another. Programming consists of designing a set of objects that model the problem. Software objects in the program can represent real or abstract entities in the problem domain [12]. This is supposed to make the design of the program more natural and hence easier to get right and easier to understand. Many programming languages support 67 was the very first language that supports this paradigm. Languages like C++, C, and Java are the most famous ones nowadays. Eiffel has been developed in 1986 by Bertrand Meyer [11], which is also an objectoriented language. S
點(diǎn)擊復(fù)制文檔內(nèi)容
高考資料相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1