Hirdetés
- Mobil flották
- Xiaomi 15T - reakció nélkül nincs egyensúly
- Kezünkben a OnePlus 15 és az Oppo Find X9-ek
- Hivatalos a OnePlus 13 startdátuma
- Google Pixel topik
- Samsung Galaxy S25 Ultra - titán keret, acélos teljesítmény
- Milyen okostelefont vegyek?
- Fotók, videók mobillal
- iPhone topik
- One mobilszolgáltatások
Új hozzászólás Aktív témák
-
Drizzt
nagyúr
válasz
Lortech
#10212
üzenetére
Miért nem simán T a paraméter az első add függvényedben, az interface-ben? Ha azt csinálod, akkor azzal meg tudod akadályozni, hogy a "impl1.add(impraw);" illetve a "impl2.add(impraw);" leforduljon. Persze az impraw.add fogad mindenféle típusú interface-et. Aztán ha type mismatch van, akkor futási időben száll el a
paramEnforcerMatrix.add(paramEnforcerVector); sor.public interface ParamEnforcer<T extends ParamEnforcer<T>> {
void add(T other);
}
class MatrixType implements ParamEnforcer<MatrixType> {
@Override
public void add(MatrixType other) {
}
}
class VectorType implements ParamEnforcer<VectorType> {
@Override
public void add(VectorType other) {
}
}
class Tester {
void test() {
MatrixType matrixType = new MatrixType();
ParamEnforcer paramEnforcerMatrix = matrixType;
VectorType vectorType = new VectorType();
ParamEnforcer paramEnforcerVector = vectorType;
matrixType.add(matrixType);
vectorType.add(vectorType);
paramEnforcerMatrix.add(paramEnforcerVector);
}
}
Új hozzászólás Aktív témák
A topicot kiemeltem. Valaki nem akar egy nyitó hsz-t írni?:))
- Microsoft Surface Go 2 m3-8100Y 8GB 128GB 1 év garancia
- -ÚJ,2 ÉV GAR- GAMER PC: i5-14400F (10mag/16szál) +RX 6600/6700XT +16-64GB DDR4! SZÁMLA! 70 féle ház!
- Microsoft Surface Go 2 m3-8100Y 8GB 128GB 4G LTE 1 év garancia
- APPLE IPAD 10.GEN 64GB Wifi , Pink szinben, Üzletből, 27% ÁFÁS
- Apple MacBook Air 13 M1 8GB 256GB magyar bill 1 év garancia
- Nvidia Quadro M2000/ P2000/ P4000/ RTX 4000/ RTX 5000/ RTX A2000
- Xiaomi Redmi 13 128GB, Kártyafüggetlen, 1 Év Garanciával
- 2db Apple Lightning - jack átalakító eladó egyben 1999 Ft
- Gamer egerek és billentyűzetek kitűnő árakon!
- Google Pixel 10 Pro XL Moonstone Super Actua 120 Hz, Pro kamera 5 zoom 256 GB Használt,Gari
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: Laptopműhely Bt.
Város: Budapest


