- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Type parametrization Interop with Java class
Thu, 2011-03-24, 17:25
Hello,
I'm trying to extend a Java class with a Scala class, but receiving an
error. Would you help, please??
I have the following Java class:
public abstract XIter
{
private Map;
public XIter(Graph g, V start)
{
}
}
I'm trying to extend the class in Scala with:
class ScalaIter[V,E] (g: graph[V, E], start: V)
extends XIter[V, E, Any]
{
}
I'm receiving the followin compiler error:
"not enough arguments for constructor XIter: (x$1: Graph[V,E],x$2:
V)XIter[V,E,Any]"
"Unspecified value parameters x$1, x$2."
If I change the XIter class to something like
public abstract XIter
with 2 arguments instead of 3, the Scala class compiles.
Any clue?
Thanks in advance,
Marcos
Thu, 2011-03-24, 21:57
#2
Re: Type parametrization Interop with Java class
Thank you! Worked fine. Sorry for posting in the wrong forum.
On Mar 24, 1:29 pm, martin odersky wrote:
> > You need to pass the arguments to the superclass constructor:
>
> class ScalaIter[V,E] (g: graph[V, E], start: V)
> extends XIter[V, E, Any] (g, start)
>
> Hope this helps.
>
> Btw, that question is better asked on scala-user, or StackOverflow.
>
> -- Martin
On Thu, Mar 24, 2011 at 5:25 PM, Marcos Ackel <mvackel@yahoo.com> wrote:
You need to pass the arguments to the superclass constructor:
class ScalaIter[V,E] (g: graph[V, E], start: V)
extends XIter[V, E, Any] (g, start)
Hope this helps.
Btw, that question is better asked on scala-user, or StackOverflow.
-- Martin