🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #16943

Re: Help needed about constructors

#16943
From: Terje Viken
Date: Wed, 06 Jan 1999 00:00
49 lines
1284 bytes
Hi!

Your child class will have to make a constructor (not necessarily with
matching arguments) which again calls the parent constructor like this.

    public Child(int i){
        super("Some text");
    }

// or
   public Child(String s){
      super( s );
  }

Try your code and see what happens...

Terje

Jean-Christian Gagn� skrev i meldingen <36907F36.29702A5F@vtx.ch>...
>Hi,
>
>If a class defines a constructor, does a subclasse inherits this
>constructor ?
>
>For example :
>
>public abstract class Parent {
>
> public Parent(String s) {...}
>}
>
>
>public class Child extends Parent {
>
> public Child(int i) {...}
>}
>
>
>Can I write
>
> Child c = new Child(myString);
>
>without declaring the corresponding constructor in Child ?
>
>
>Thanks
>
>
>JCG
Technical Details
Message-ID: <76vh8g$bg6$1@romeo.dax.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36907F36.29702A5F@vtx.ch>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f74b3,817ee5543e3b83d
X-Google-Attributes: gidf74b3,public
From: "Terje Viken" <teviken@c2i.net>
Subject: Re: Help needed about constructors
Date: 1999/01/06
Message-ID: <76vh8g$bg6$1@romeo.dax.net>
X-Deja-AN: 429368878
References: <36907F36.29702A5F@vtx.ch>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Organization: Tele2 Norway Public Access
Newsgroups: borland.public.jbuilder.java.language