abstract

    1熱度

    2回答

    我在PHP中遇到了OOP中的一個問題。我試圖實現一個抽象的父類方法,並從子類,我必須使用它與可變數目的參數。 這裏是拋出的錯誤: PHP Fatal error: Declaration of Square::getArea($length) must be compatible with Shape::getArea() 及其類別: abstract class Shape { abs

    1熱度

    2回答

    我有一個從collections.Counter繼承Python類: class Analyzer(collections.Counter): pass 當我使用pylint的這個代碼,它的答案是: w^:方法'fromkeys'在類'Counter'中是抽象的但不會被覆蓋(抽象方法) 我在我的機器上檢查了collections.Counter的實現,有效地,這種方法沒有實現(和註釋

    -3熱度

    2回答

    我有下面的代碼,我不斷收到錯誤必須有一個身體,因爲它沒有標記爲抽象的extern或部分。 public interface Shape{ int GetArea(); } public class shape:Shape{ int height; int width; int radius; int GetArea(); } class

    0熱度

    1回答

    我一直在使用MessagePackKnownCollectionItemTypeAttribute和 [MessagePackKnownCollectionItemTypeAttribute("MyAbstractBase", typeof(MyImpl))] Dictionary<int, MyAbstractBase> class_member; 這偉大的工作,但怎麼樣,如果我有: [Mess

    2熱度

    1回答

    我想讓Typescript Mixin具有由混合類實現的抽象方法。像這樣的東西。現在 class MyBase { } type Constructor<T = {}> = new (...args: any[]) => T; function Mixin<TBase extends Constructor<MyBase>>(Base: TBase) { return clas

    0熱度

    1回答

    我想在視口/屏幕的底部放置文本輸入。它工作正常,它甚至在onfocus事件後「粘」到鍵盤的頂部。 但是,當鍵盤關閉時,改變的位置(鍵盤頂部)和原始位置(視口底部)之間存在滯後。 我的元素的CSS是: .fixed { position: absolute; z-index: 1000; height: 50px; display: block; b

    2熱度

    2回答

    我有一個抽象類,只有一個抽象方法;和一些實施班(約6人)。 該方法返回一個「需要」兩個參數的對象。 但是,在某些情況下,只需要兩個參數中的一個。 有沒有一種優雅的方式來實現這種情況? (而不是返回該參數爲空) public class NormResult { protected List<String> normWords; protected List<String> un

    1熱度

    1回答

    我需要輸入一個用戶輸入的字符,並使用遞歸將它插入正確字母位置的字符串中,然後請求另一個字符。一次只能輸入一個字符。 我認爲一個好方法是掃描字符串,當輸入的字符匹配字母串中的字符時,然後插入它。但是我很難將其轉化爲代碼。我也必須使用遞歸(堆棧,$ jal,$ jr $ ra),但我並不完全熟悉如何使用它。 這是到目前爲止我的代碼: .data str: .asciiz "abcdefg

    4熱度

    1回答

    我是Delphi的新手。在TStrem類的文檔中,我讀到它是一個抽象類。 所以我覺得編譯器進入錯誤,當我嘗試用 stream := TStream.Create(); 爲什麼不創建呢?

    0熱度

    1回答

    我有一個抽象類,併爲它執行兩個實現。 public abstract class Person{ public abstract string GetName(); } public class Doctor : Person{ public override string GetName() { return "Doctor"; } }