Our task was to go through all of the elements and the list of the drawables,
to check which ones are movable. That's done with the instance of operator. Now
then we wanted to move them, but of course, we have convert them from drawables
to moveables, that's done with this cast. Take the drawable, cast to moveable,
save it in a moveable variable, and then we can use that variable to exercise
the move method. When we run the program, we see the cars move, we see the dogs
move, which really is a moving experience. Now, I'll turn it over to Sara,
who will talk to you more about interfaces, the instance of operator and
casting.
Nuestra tarea era ir a través de todos los elementos y de la lista de Dibujables
para comprobar cuáles son móviles. Eso se hace con el operador instanceof (instanciade). Ahora,
entonces queríamos moverlos, pero, por supuesto, tenemos que convertirlos de Dibujables
a Movibles y eso se hace con cast. Tome Dibujable, lo transformo a Movibles,
los guardo en una variable Movible y luego podemos usar esa variable para ejercer
el método move. Cuando ejecutamos el programa, vemos que los coches se mueven, vemos que los perros
se mueven, en realidad es una experiencia en movimiento. Ahora le cedo la palabra a Sara
que te hablará más sobre las interfaces, el operador instanceof y el
casting.
Notre tâche consistait à passer
en revue tous les éléments
et la liste d'éléments graphiques,
afin de vérifier lesquels sont mobiles.
C'est fait avec l'instance de l'opérateur.
Maintenant, nous voulons
les déplacer, mais
nous devons les convertir
de Drawable en Moveable,
c'est fait avec cette distribution.
Prenez Drawable, convertissez
le en Moveable,
enregistrez-le en
variable Moveable,
puis nous pouvons utiliser cette variable
pour exercer la méthode Move.
Quand nous lançons le programme,
nous voyons les voitures bouger,
nous voyons les chiens bouger dans
une scène tout simplement émouvante.
Je vais céder la parole à Sara,
qui vous parlera davantage des interfaces,
de l'instance de l'opérateur
et de la conversion.
すべての要素とDrawableのリストを見て
どれがmovableかを確認しました
オペレータのインスタンスで行いました
そしてこれらを動かすためにDrawableから
Movableに変換しなければなりません
このキャストで行います
DrawableをMovableにキャストし
それを変数Movableに格納します
するとその変数を
moveメソッドで使うことができます
プログラムを実行すると
実際に車と犬が動きます ここでサラに代わります
インターフェース、オペレータのインスタンス、
キャスティングについて詳しくお話しします
Drawable들의 요소를 모두 검사해서 Moveable인지
알아보는 것이 목적이었습니다. instanceof 연산자를 이용해서 할 수 있습니다.
이제 옮겨야 합니다. 하지만 강제 형변환을 통해 Drawables를
Moveables로 변환해야 합니다. Drawable을 Moveable로 강제 형변환을
합니다. 그런 후에 Moveable 변수에 저장하고 그 변수를 이용해서
move 메소드를 호출할 수 있습니다. 프로그램을 실행하면, 자동차들과
강아지들이 움직이는 것이 보입니다. 이제 Sara에게 넘기겠습니다.
Sara는 인터페이스, instanceof 연산자, 그리고
강제 형변환에 대해 더 수업을 할 겁니다.
Nhiệm vụ của ta là đi qua toàn bộ phần tử của list các drawables,
kiểm tra cái nào là movable. Được làm bởi toán tử instanceof.
Sau đó ta muốn di chuyển chúng, nhưng tất nhiên, ta phải convert chúng
từ drawables thành movables, được làm bởi cái ép kiểu này. Lấy drawable, ép kiểu sang movable,
lưu nó trong biến kiểu movable, sau đó ta dùng biến đó
để chạy move method. Khi chạy chương trình, ta thấy các xe đã di chuyển, chó nữa,
Giờ tôi sẽ chuyển nó qua Sara,
cô ấy sẽ nói thêm về interfaces, toán tử instanceof
và casting (ép kiểu).