--- In [email protected], Pratik K Anand <pratik.k.an...@...> wrote:
>
> rajkumargoel_786 wrote:
>
> Now consider the case,
> > scala> trait a
> > defined trait a
> >
> > scala> object a{
> > | class b extends a
> > | }
> > defined module a
> >
> > scala> val c:a=a
> > <console>:6: error: type mismatch;
> > found : a.type (with underlying type object a)
> > required: a
> > val c:a=a
> > .....can anyone explain the reason
> >
>
> Interesting, this worked but i don't think this is what you asked for...
>
> pra...@pratik:~$ scala
> Welcome to Scala version 2.7.3final (OpenJDK Client VM, Java 1.6.0_0).
> Type in expressions to have them evaluated.
> Type :help for more information.
>
> scala> trait a
> defined trait a
>
> scala> object a {
> | class b extends a
> | }
> defined module a
>
> scala> val c=a
> c: a.type = a...@598d00
>
>
> [Non-text portions of this message have been removed]
>
HI pratik,
Thats fine ,but what I was asking is
when I specify the type to the val why does it give a error?
not
val c=a
but
val c:a=a {c of type a =a}