mi serve sapere di che tipo è un oggetto x fare un controllo del tipo
se l'ogg in ingresso è dello stesso tipo di un'altro allora....
mi serve sapere di che tipo è un oggetto x fare un controllo del tipo
se l'ogg in ingresso è dello stesso tipo di un'altro allora....
Alessandro, l'unico pinguino con le scarpe da ginnastica
PhpItalia.net - il portale definitivo sul PHP
usa oggetto instanceof classe
The individual has always had to struggle to keep from being overwhelmed by the tribe. If you try it, you will be lonely often, and sometimes frightened. But no price is too high to pay for the privilege of owning yourself.
si, lo so che posso usare instanceof ma il problema è che non conosco il tipo
voglio fare il confronto dei tipi tra due oggetti che non so a priori cosa siano
chiaro ?
Alessandro, l'unico pinguino con le scarpe da ginnastica
PhpItalia.net - il portale definitivo sul PHP
si...
oggetto.getClass() e poi le confronti.
comunque, per trovare queste cose http://java.sun.com/j2se/1.4.1/docs/api/
The individual has always had to struggle to keep from being overwhelmed by the tribe. If you try it, you will be lonely often, and sometimes frightened. But no price is too high to pay for the privilege of owning yourself.
le api ce le ho già ma non riesco ad orientarmi bene
cmq mi da errore qui
} else if (a instanceof ping.info.getClass() ) {
illegal start of type
Alessandro, l'unico pinguino con le scarpe da ginnastica
PhpItalia.net - il portale definitivo sul PHP
no, fai il getClass di entrambi e poi li confronti... io non l'ho mai fatto, ma occhio dovrebbe funzionare...Originariamente inviato da alessandro.alex
le api ce le ho già ma non riesco ad orientarmi bene
cmq mi da errore qui
} else if (a instanceof ping.info.getClass() ) {
illegal start of type
The individual has always had to struggle to keep from being overwhelmed by the tribe. If you try it, you will be lonely often, and sometimes frightened. But no price is too high to pay for the privilege of owning yourself.
così me lo compila tranquillo
if (a.getClass().equals(ping.info.getClass())) {...
grazie
Alessandro, l'unico pinguino con le scarpe da ginnastica
PhpItalia.net - il portale definitivo sul PHP
l'ho testato e funziona alla grande, grazie:metallica
Alessandro, l'unico pinguino con le scarpe da ginnastica
PhpItalia.net - il portale definitivo sul PHP
di niente... tieni conto che l'api è un ottima fonte di informazione, se la usi bene non ti serve altra documentazione.
ciao
The individual has always had to struggle to keep from being overwhelmed by the tribe. If you try it, you will be lonely often, and sometimes frightened. But no price is too high to pay for the privilege of owning yourself.
lo sò che è una cosa utilissima, il problema è che non riesco bene a girarmi dentro ad esse
x es il getClass() io non l'ho trovato, dov'era ?
Alessandro, l'unico pinguino con le scarpe da ginnastica
PhpItalia.net - il portale definitivo sul PHP