constructor

    0熱度

    1回答

    我一直無法找到與我的問題有關的答案。就我看到的情況而言,這有點「奇怪」。 所以我有一個類Child2繼承自Child1,繼而從Parent繼承。 Parent沒有構造函數。 這裏是我如何繼承: Child1.h: class Child1 : virtual public Parent 這是我想從Child2的構造函數中調用該函數: void Child1::foo(unsigned int

    2熱度

    2回答

    數組我有一個類 class TTable { private: std::string tableName; public: TRow rows[10]; //this other class TRow TTable(const TTable&); int countRows = 0; }; 我實現了拷貝構造函數 TTable::TTable(c

    0熱度

    1回答

    我想將Button的子類化爲OPButtun。 OPButton是一個常規的Button,當鼠標懸停時可以編寫幫助消息。 OPButton必須接受任何可能的參數列表THRE常規按鈕構造函數會接受,加上兩個我自己的:消息和STRINGVAR哪裏把它寫在 這是我的代碼(據說可運行) from tkinter import * from tkinter import ttk class OPBut

    1熱度

    1回答

    所以我遇到了我的代碼問題,我的循環結束後我的「C」的情況。我需要它打印出一條消息,說明商店已滿並保持循環備份並打印出主菜單。另外,當我在添加新寵物後列出所有寵物時,我的寵物3沒有被保存。我 import java.util.*; public class MainPets { static Scanner scan = new Scanner(System.in); private s

    0熱度

    1回答

    我想動態設置屬性,這樣 form = ModelForm(request.form) 文件FlaskForm form.py class ModelForm(FlaskForm): def __init__(self, postData): super(ModelForm, self).__init__() for p in postData:

    1熱度

    1回答

    出於某種原因,在添加一個名爲「Oliver」的寵物後,主菜單將打印出兩次「無效選擇」行。我只是需要另一雙眼睛來看它,因爲我一直在看它幾個小時,並一直在修正一些小錯誤,無濟於事。 代碼時RAN看起來是這樣的: /*Welcome to the pet store.Type the letter to make your selection A. List the pets in the

    -2熱度

    1回答

    我是新來的c + +編程,我被困在一個部分,兩個成員顯示相同的價值..你們可以解釋爲什麼嗎? Thx提前。 #include<iostream> using namespace std; class test{ public: int all,sum; test(int x){ all=x; } test(test &a){

    1熱度

    1回答

    什麼 我試過到目前爲止回調與單一的參數,它的工作原理: class SomeClass (something:Int = 3, val callback: (Int) -> Unit) { fun doSomething() { callback(11) } } class AnotherClass { val something = SomeCl

    4熱度

    1回答

    有人可以解釋下面示例中初始化雙花括號和單花括號之間的行爲差​​異嗎? 代碼#1: vector<string> v = {"a", "b"}; string c(v[0] + v[1]); cout << "c = " << c; cout << "c.c_str() = " << c.c_str(); 輸出#1: c = ab c.c_str() = ab 代碼#2: vecto

    0熱度

    2回答

    我想了解爲什麼下面的C++程序輸出它的功能。 #include <iostream> #include <vector> #include <initializer_list> #include <memory.h> using namespace std; // Constructors and memory class Test{ static const int