Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #15194
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | bilsch <bilsch01@gmail.com> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: It doesn't like 'super' where ever I put it. |
| Date | Sun, 10 Jun 2012 13:17:14 -0700 |
| Organization | A noiseless patient Spider |
| Lines | 39 |
| Message-ID | <jr2vca$32l$2@dont-email.me> (permalink) |
| References | <jr27ce$7uo$1@dont-email.me> <ydny5nvgt9d.fsf@shell.xmission.com> <jr2aet$pv7$1@dont-email.me> <ydntxyjgmkb.fsf@shell.xmission.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Sun, 10 Jun 2012 20:17:14 +0000 (UTC) |
| Injection-Info | mx04.eternal-september.org; posting-host="llALXQ6TxsVqIoSLcrwVyA"; logging-data="3157"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Evp8nODElMYNQqcRQdm4U" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 |
| In-Reply-To | <ydntxyjgmkb.fsf@shell.xmission.com> |
| Cancel-Lock | sha1:2k7NRd2BYSFxWndnWpEFoaLVj+o= |
| Xref | csiph.com comp.lang.java.programmer:15194 |
Show key headers only | View raw
On 6/10/2012 9:26 AM, Jim Janney wrote:
> bilsch<bilsch01@gmail.com> writes:
>
>> On 6/10/2012 7:02 AM, Jim Janney wrote:
>>> bilsch<bilsch01@gmail.com> writes:
>>>> BUILD SUCCESSFUL (total time: 2 seconds)
>>>
>>> Try changing
>>>
>>> public void CalcFrame1() {
>>>
>>> to
>>>
>>> public CalcFrame1() {
>>>
>> OK. Thanks. Can you tell me why that makes a difference?
>
> Constructors are fundamentally different from ordinary methods, so most
> object-oriented languages use a different syntax for them. In Java, a
> constructor definition looks like a method, but without an explicit
> return type and using a name that matches the class name. In other
> languages the syntax may be different -- for example, in Python the name
> is always __init__ -- but the underlying idea is the same: constructors
> are not ordinary methods and take a different syntax.
>
> Why are constructors different? Most classes have some code that you
> want to run whenever a new object is created, and it would be tedious to
> have to call it explicitly every time. I used to mimic OOP in C and you
> had to do things like
>
> struct Foo* foo = (struct Foo*) malloc(sizeof(struct Foo));
> foo->init();
>
> Forcing all object creation to go through a constructor makes the code
> simpler and more reliable. And even when a class has a constructor that
> appears to be empty, there's still some code that the compiler generates
> automatically the make the new object a proper instance of its class.
>
Thanks for the info.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-10 06:27 -0700
Re: It doesn't like 'super' where ever I put it. v_borchert@despammed.com (Volker Borchert) - 2012-06-10 13:49 +0000
Re: It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-10 07:08 -0700
Re: It doesn't like 'super' where ever I put it. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-10 11:34 -0400
Re: It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-10 12:58 -0700
Re: It doesn't like 'super' where ever I put it. markspace <-@.> - 2012-06-10 13:43 -0700
Re: It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-11 21:01 -0700
Re: It doesn't like 'super' where ever I put it. v_borchert@despammed.com (Volker Borchert) - 2012-06-10 15:44 +0000
Re: It doesn't like 'super' where ever I put it. Robert Klemme <shortcutter@googlemail.com> - 2012-06-10 20:39 +0200
Re: It doesn't like 'super' where ever I put it. "Gavino" <invalid@invalid.invalid> - 2012-06-11 20:13 +0200
Re: It doesn't like 'super' where ever I put it. Robert Klemme <shortcutter@googlemail.com> - 2012-06-11 22:51 +0200
Re: It doesn't like 'super' where ever I put it. "Gavino" <invalid@invalid.invalid> - 2012-06-12 00:45 +0200
Re: It doesn't like 'super' where ever I put it. Martin Gregorie <martin@address-in-sig.invalid> - 2012-06-11 22:53 +0000
Re: It doesn't like 'super' where ever I put it. Lew <lewbloch@gmail.com> - 2012-06-11 16:42 -0700
Re: It doesn't like 'super' where ever I put it. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-11 19:53 -0400
Re: It doesn't like 'super' where ever I put it. Lew <lewbloch@gmail.com> - 2012-06-11 17:38 -0700
Re: It doesn't like 'super' where ever I put it. "John B. Matthews" <nospam@nospam.invalid> - 2012-06-11 23:14 -0400
Re: It doesn't like 'super' where ever I put it. Robert Klemme <shortcutter@googlemail.com> - 2012-06-12 18:21 +0200
Re: It doesn't like 'super' where ever I put it. Robert Klemme <shortcutter@googlemail.com> - 2012-06-11 22:50 +0200
Re: It doesn't like 'super' where ever I put it. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-10 09:59 -0400
Re: It doesn't like 'super' where ever I put it. Jim Janney <jjanney@shell.xmission.com> - 2012-06-10 08:02 -0600
Re: It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-10 07:20 -0700
Re: It doesn't like 'super' where ever I put it. Leif Roar Moldskred <leifm@dimnakorr.com> - 2012-06-10 09:49 -0500
Re: It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-10 13:15 -0700
Re: It doesn't like 'super' where ever I put it. Jim Janney <jjanney@shell.xmission.com> - 2012-06-10 10:26 -0600
Re: It doesn't like 'super' where ever I put it. Jim Janney <jjanney@shell.xmission.com> - 2012-06-10 11:24 -0600
Re: It doesn't like 'super' where ever I put it. Jim Janney <jjanney@shell.xmission.com> - 2012-06-10 11:38 -0600
Re: It doesn't like 'super' where ever I put it. v_borchert@despammed.com (Volker Borchert) - 2012-06-10 18:17 +0000
Re: It doesn't like 'super' where ever I put it. Lew <noone@lewscanon.com> - 2012-06-10 12:26 -0700
Re: It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-10 13:17 -0700
Re: It doesn't like 'super' where ever I put it. Roedy Green <see_website@mindprod.com.invalid> - 2012-06-10 11:54 -0700
Re: It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-10 13:24 -0700
Re: It doesn't like 'super' where ever I put it. Lew <noone@lewscanon.com> - 2012-06-10 13:56 -0700
Re: It doesn't like 'super' where ever I put it. bilsch <bilsch01@gmail.com> - 2012-06-11 20:55 -0700
Re: It doesn't like 'super' where ever I put it. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-06-11 16:41 -0700
csiph-web