destructor

    0熱度

    1回答

    我已經創建了一個八叉樹數據結構,但它並不完美。我正在努力與複製構造函數和析構函數。 這裏是我的頭文件: class Octree { public: static int lastbranch; static bool utolsoelotti; struct node { int value; node *child[8]; }; Octree(); ~

    0熱度

    4回答

    #include <iostream> struct ABC{ int A; ABC(int i = 1) : A(i) {} ~ABC() { std::cout << A << std::endl; } void destruct() { delete this; } }; int main() {

    3熱度

    1回答

    #include <iostream> using namespace std; class teacher{ private: int Tnum; public: teacher(){ Tnum = 0; } teacher(int n){ cout << "creating teacher"<<endl;

    2熱度

    4回答

    我在Windows7上使用Qt5,最近我發現了an interesting Qt example code。 基本上,它看起來像這樣: ButtonWidget::ButtonWidget(const QStringList &texts, QWidget * parent) : QWidget(parent) { signalMapper = new QSignalMapper(t

    0熱度

    1回答

    我該如何正確創建我的散列表的析構函數?我可以刪除[]列表嗎?我使用線性探測來處理我的碰撞...不知道這是否與創建我的析構函數有關。 class Graph { ... private: vertex_node **list Graph::Graph() { size = 0; capacity = INITIAL_CAP; list = new vertex_node *

    1熱度

    1回答

    #include<iostream> using namespace std; class Monster { public: Monster() {cout << "with out argument. \n";} Monster(int sz) { cout << "Monster created.\n"; } ~Monster() { cout

    0熱度

    1回答

    我有一個問題,在過去的論文中詢問,在Solo中添加一個析構函數,在其實現中添加語句delete oneInstance會產生什麼影響。 究竟添加刪除oneInstance的效果如何? class Solo { public: Solo* instance(); private: Solo(); static Solo* oneInst

    0熱度

    1回答

    在我的信息模型中,有超過400個數據類型,它們的命名方式如下:AutomationDomainType。類型(構造函數和成員)是從模型生成的,但不幸的是沒有生成析構函數。所以,我要實現自己的析構函數,並呼籲他們在我的主要功能: void deleteObjectTypeUA(OpcUa_UInt16 ObjID, OpcUa_UInt16 NsIdx) { if (ObjID == Pref

    1熱度

    1回答

    以下是C++源代碼。該代碼具有HumanBeing類以及顯示和驗證功能。每個函數都打印語句。 #include <iostream> using namespace std; class HumanBeing{ public : void display() { cout << "hello aam a human being" << endl;

    -3熱度

    1回答

    我對C非常陌生,我試圖完全理解它。我實現了一個堆棧 ,但在創建析構函數和構造函數/ init時遇到了麻煩。 這些做得好嗎? 這些是由堆棧中使用的結構類型定義: typedef struct Node{ void* cargo; struct Node* next; }Node; typedef struct Stack{ int size; Node*