forward-declaration

    0熱度

    1回答

    我有很多不同的向前聲明組合的發揮各地,這似乎是最好的之一。這是編譯只有一個,直到我註釋掉行 e->process(this); 而且我從Xcode的一個錯誤,指出: non-const lvalue reference to type 'Event::ModemSimV2' cannot bind to a temporary type 'ModemSimV2' 我真的不明白是什麼意思,任

    2熱度

    4回答

    是否可以在Objective C頭文件中對名稱空間內的C++類進行前向聲明? C++類轉發聲明在Objective C: namespace name { class Clazz { }; } 我知道我可以的,如果在C++類不在一個命名空間。取自http://www.zedkep.com/blog/index.php?/archives/247-Forwar

    3熱度

    4回答

    像C和C++這樣的語言依賴前向聲明來解決類型或函數聲明中的循環依賴性。在C#中,這不再是必需的,因爲聲明捕獲階段分爲兩個階段;一個捕獲符號名稱,另一個實際執行符號聲明構建。 是否有符號名稱捕獲階段的標準名稱?我假設聲明捕獲將留待對於涉及解決在聲明中的所有符號的傳統相

    1熱度

    3回答

    我有一個非常簡單的父子關係,其中OlderSon從父繼承和家長有一個指針指向他OlderSon,如: #ifndef PARENT_HXX #define PARENT_HXX #include <iostream> #include <string> //#include "OlderSon.hxx" class OlderSon; class Parent { priv

    4熱度

    2回答

    將聲明轉發到另一個頭文件中合法嗎?例如: #ifndef _MAIN_H_ #define _MAIN_H_ class ClassA; class ClassB; #include "classa.h" #include "classb.h" #endif #ifndef _CLASSA_H_ #define _CLASSA_H_ #include "main.h" cla

    4熱度

    2回答

    我從模板類繼承。當我在老師課上入學時,我想在科目類&中進入。 我得到一個錯誤使用不完整的類型struct Subect; void addSubject(Subject *s) { this->addReference(s); s->addReference(this); when I comment this line the it compiles without

    2熱度

    1回答

    我有一個這樣的協議: #import <Foundation/Foundation.h> @protocol Prot1 <NSObject> @required - (void)methodInProtocol; @end 這是一個委託協議我想在這樣的類來存儲: #import <Cocoa/Cocoa.h> @class Prot1; @interface Class

    2熱度

    2回答

    假設我已經聲明瞭一些模板類,並且想要typedef指向它的共享指針。我將如何做到這一點? template<typename T> class Arg; typedef std::tr1::shared_ptr<Arg> ArgPtr; // Compiler error

    3熱度

    1回答

    我試着做A類B類的朋友 class B; class A{ public: void show(const B&); // ##1## but this one works fine B ob;// error incomplete type }; class B{ public: int b; B():b(1){} friend class A; }; 所以我

    5熱度

    3回答

    我很清楚什麼時候可以/不能使用前向聲明,但我仍然不確定一件事情。 比方說,我知道我必須包括一個頭遲早要取消引用類A. 的對象我不是它是否更有效地做這樣的事情清楚.. class A; class B { A* a; void DoSomethingWithA(); }; 然後在CPP有類似.. #include "A.hpp" void B::DoSomething