Hi Raj,

val c:a=a

what is a here??
trait or object,
Its trait not object so

val c:a =new a

when you say val c=a what gets assigned is object a
because in scala like java class address is classn...@hashcode
for object objectna...@hashcode


I am not sure if it helps.
Please tell me if i understood the whole thing wrongly.

thanks,

SMS
On Wed, Jun 24, 2009 at 9:43 PM, rajkumargoel_786 <
rajkumargoel_...@yahoo.co.in> wrote:

>
>
> --- In twincling@yahoogroups.com <twincling%40yahoogroups.com>, 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}
>
>  
>


[Non-text portions of this message have been removed]

Reply via email to