Can a class use a mixin, where the mixin uses another mixin?

56 views
Skip to first unread message

Dzenan Ridjanovic

unread,
Apr 13, 2015, 5:18:06 PM4/13/15
to mi...@dartlang.org
The following error appears eventhough the MovablePiece class extends Object:

stars/model/stars.dart': error: line 3 pos 32: mixin class 'MovablePiece' must extend class 'Object'
class Star extends Object with MovablePiece {

In lib/model/pieces/pieces.dart:
no constructor in Piece
no super in Piece
class Piece {

no constructor in MovablePiece
no super in MovablePiece
class MovablePiece extends Object with Piece {

Can a class use a mixin, where the mixin uses another mixin?


in examples/stars/model/stars.dart:
change
class Star extends MovablePiece {
to
class Star extends Object with MovablePiece {

Gilad Bracha

unread,
Apr 13, 2015, 7:43:56 PM4/13/15
to mi...@dartlang.org
MovablePiece isn't direct subclass of Object; the superclass of MovablePiece is Object with Piece, which is an application of the mixin Piece to Object (and as such, the same as class Piece).  So it is just like saying class MovablePiece extends Piece.
In short, you can't do this right now

On Mon, Apr 13, 2015 at 2:18 PM Dzenan Ridjanovic <dze...@gmail.com> wrote:
The following error appears eventhough the MovablePiece class extends Object:

stars/model/stars.dart': error: line 3 pos 32: mixin class 'MovablePiece' must extend class 'Object'
class Star extends Object with MovablePiece {

In lib/model/pieces/pieces.dart:
no constructor in Piece
no super in Piece
class Piece {

no constructor in MovablePiece
no super in MovablePiece
class MovablePiece extends Object with Piece {

Can a class use a mixin, where the mixin uses another mixin?


--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.

Dzenan Ridjanovic

unread,
Apr 13, 2015, 8:11:51 PM4/13/15
to mi...@dartlang.org
Thanks Gilad.

Dzenan
Reply all
Reply to author
Forward
0 new messages