Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!bl1g2000vbb.googlegroups.com!not-for-mail From: Alessio Stalla Newsgroups: comp.lang.java.programmer Subject: Re: calling own methods from constructor Date: Thu, 7 Apr 2011 10:40:51 -0700 (PDT) Organization: http://groups.google.com Lines: 18 Message-ID: <455e7ffb-369e-4d88-912e-01581c7cbfb5@bl1g2000vbb.googlegroups.com> References: <2011040622233261380-angrybaldguy@gmailcom> NNTP-Posting-Host: 94.36.35.86 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1302198051 14980 127.0.0.1 (7 Apr 2011 17:40:51 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 7 Apr 2011 17:40:51 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: bl1g2000vbb.googlegroups.com; posting-host=94.36.35.86; posting-account=lQGEkQoAAAB85u9ZdpjVtg0WoVPxKpxu User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; it; rv:1.9.2.16) Gecko/20110323 Ubuntu/10.10 (maverick) Firefox/3.6.16,gzip(gfe) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:2939 On 7 Apr, 14:19, Andreas Leitgeb wrote: > Casting in C++ is something different than in Java. > Although, if you really do C, not C++, then it's it's > much more like Java, except for the lacking safety net. I don't know about C++, but in C casting is not like Java at all. In Java a cast is a runtime operation that checks the type of some object (I'm not considering primitives). Of course the compiler knows about it and uses it at compile-time too for type checking, but that's somewhat a consequence of the previous point. In C, instead, casting has no(*) runtime behavior; it's just an instruction for the compiler: "please consider this datum to be of this type". If the compiler accepts your order, it will blindly treat that datum as if it's of the type you told it is, even if at runtime it's not. (*) actually, it might perform conversions in certain corner cases, but still no runtime type check is ever done.