Thank you. I did a mistake I meant cat.*new*(1, 2). It would be easier to distinguish between a function cat(1,2) and a class cat(1,2).
On Wed, Apr 11, 2012 at 10:11 PM, Amitava Shee <[email protected]>wrote: > You don't need to invoke new - > > let c : cat = cat(1, 2); > > will do. > > -Amitava > > On Wed, Apr 11, 2012 at 5:54 AM, Mic <[email protected]> wrote: > >> Hello, >> How about to create an instance with class.new like in Ruby, because in >> the class is a new method? >> >> class cat { >> priv { >> let mutable x : int; >> fn meow() { log_err "Meow"; } >> } >> >> let y : int; >> >> new(in_x : int, in_y : int) { x = in_x; self.y = in_y; } >> >> fn speak() { meow(); } >> >> fn eat() { ... } >> } >> >> >> let c : cat = cat(1, 2).*new*; >> c.speak(); >> >> >> _______________________________________________ >> Rust-dev mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/rust-dev >> >> > > > -- > Amitava Shee > Software Architect > > There are two ways of constructing a software design. One is to make it so > simple that there are obviously no deficiencies; the other is to make it so > complicated that there are no obvious deficiencies. The first method is far > more difficult. > -- C. A. R. Hoare The Emperor's Old Clothes, CACM February 1981 >
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
