Open wwzeng1 opened 2 weeks ago
src/main/scala/FBoundedPolymorphism.scala
---
+++
@@ -1,5 +1,8 @@
class Crocodile extends Animal[Crocodile] {
override def breed: List[Animal[Crocodile]] = ???
+ }
+ class Lion extends Animal[Lion] {
+ override def breed: List[Animal[Lion]] = ???
}
trait Entity[E <: Entity[E]] //ORM
class Person extends Comparable[Person] { //FBP
src/main/scala/FBoundedPolymorphism.scala
---
+++
@@ -1,5 +1,8 @@
class Lion extends Animal[Lion] {
override def breed: List[Animal[Lion]] = ???
+ }
+ class Tiger extends Animal[Tiger] {
+ override def breed: List[Animal[Tiger]] = ???
}
trait Entity[E <: Entity[E]] //ORM
class Person extends Comparable[Person] { //FBP
src/main/scala/FBoundedPolymorphism.scala
---
+++
@@ -1,5 +1,8 @@
class Tiger extends Animal[Tiger] {
override def breed: List[Animal[Tiger]] = ???
+ }
+ class Elephant extends Animal[Elephant] {
+ override def breed: List[Animal[Elephant]] = ???
}
trait Entity[E <: Entity[E]] //ORM
class Person extends Comparable[Person] { //FBP
src/main/scala/FBoundedPolymorphism.scala
---
+++
@@ -1,5 +1,8 @@
class Elephant extends Animal[Elephant] {
override def breed: List[Animal[Elephant]] = ???
+ }
+ class Giraffe extends Animal[Giraffe] {
+ override def breed: List[Animal[Giraffe]] = ???
}
trait Entity[E <: Entity[E]] //ORM
class Person extends Comparable[Person] { //FBP
src/main/scala/FBoundedPolymorphism.scala
---
+++
@@ -1,5 +1,8 @@
class Giraffe extends Animal[Giraffe] {
override def breed: List[Animal[Giraffe]] = ???
+ }
+ class Penguin extends Animal[Penguin] {
+ override def breed: List[Animal[Penguin]] = ???
}
trait Entity[E <: Entity[E]] //ORM
class Person extends Comparable[Person] { //FBP
src/main/scala/FBoundedPolymorphism.scala
---
+++
@@ -1,5 +1,8 @@
class Penguin extends Animal[Penguin] {
override def breed: List[Animal[Penguin]] = ???
+ }
+ class Kangaroo extends Animal[Kangaroo] {
+ override def breed: List[Animal[Kangaroo]] = ???
}
trait Entity[E <: Entity[E]] //ORM
class Person extends Comparable[Person] { //FBP
src/main/scala/FBoundedPolymorphism.scala
---
+++
@@ -1,5 +1,8 @@
class Kangaroo extends Animal[Kangaroo] {
override def breed: List[Animal[Kangaroo]] = ???
+ }
+ class Dolphin extends Animal[Dolphin] {
+ override def breed: List[Animal[Dolphin]] = ???
}
trait Entity[E <: Entity[E]] //ORM
class Person extends Comparable[Person] { //FBP
src/main/scala/FBoundedPolymorphism.scala
---
+++
@@ -1,5 +1,8 @@
class Dolphin extends Animal[Dolphin] {
override def breed: List[Animal[Dolphin]] = ???
+ }
+ class Eagle extends Animal[Eagle] {
+ override def breed: List[Animal[Eagle]] = ???
}
trait Entity[E <: Entity[E]] //ORM
class Person extends Comparable[Person] { //FBP
src/main/scala/FBoundedPolymorphism.scala
---
+++
@@ -1,5 +1,8 @@
class Eagle extends Animal[Eagle] {
override def breed: List[Animal[Eagle]] = ???
+ }
+ class Panda extends Animal[Panda] {
+ override def breed: List[Animal[Panda]] = ???
}
trait Entity[E <: Entity[E]] //ORM
class Person extends Comparable[Person] { //FBP
src/main/scala/FBoundedPolymorphism.scala
---
+++
@@ -1,5 +1,8 @@
class Panda extends Animal[Panda] {
override def breed: List[Animal[Panda]] = ???
+ }
+ class Gorilla extends Animal[Gorilla] {
+ override def breed: List[Animal[Gorilla]] = ???
}
trait Entity[E <: Entity[E]] //ORM
class Person extends Comparable[Person] { //FBP
These changes have added 10 new animal examples to the FBoundedPolymorphism.scala
file, each demonstrating the use of F-Bounded Polymorphism. The new classes are Lion, Tiger, Elephant, Giraffe, Penguin, Kangaroo, Dolphin, Eagle, Panda, and Gorilla. Each class extends the Animal trait with its own type as the type parameter, following the existing pattern in the file.
Continue the conversation with Sweep here: http://localhost:3000/c/93e95ac7-e43d-41e7-86a2-99a12bbc7c27.
:book: For more information on how to use Sweep, please read our documentation.
do each of the 10 animals in a separate code_change
Add 10 new animal examples to FBoundedPolymorphism.scala
Description:
Extend the
FBoundedPolymorphism.scala
file with 10 additional animal examples to demonstrate F-Bounded Polymorphism.Tasks:
src/main/scala/FBoundedPolymorphism.scala
, add the following new animal classes:src/main/scala/FBoundedPolymorphism.scala
, add:src/main/scala/FBoundedPolymorphism.scala
, add:src/main/scala/FBoundedPolymorphism.scala
, add:src/main/scala/FBoundedPolymorphism.scala
, add:src/main/scala/FBoundedPolymorphism.scala
, add:src/main/scala/FBoundedPolymorphism.scala
, add:src/main/scala/FBoundedPolymorphism.scala
, add:src/main/scala/FBoundedPolymorphism.scala
, add:src/main/scala/FBoundedPolymorphism.scala
, add: