public class Derived extends base { public Derived() { super(); }
public Derived(int iVal) { super(iVal); } } On Thursday, November 29, 2012 12:34:56 PM UTC-5, Simon Giddings wrote: > > This may seem a bit basic, but I come from a C++ background and it is > confusing me a little. > > When I extend a base class, do I need to create a constructor for each > base class constructor ? > What I mean is this. Given : > > public class base > { > protected int m_iValue; > > public base() > { > m_iValue = 0; > } > > public base(int iVal) > { > m_iValue = iVal; > } > } > > If I want to create a new class based on this base class, will I need to > declare the two constructors again for them to be visible ? > The following seems to hide the second constructor of the base class. > > public class Derived extends base > { > public Derived() > { > super(); > } > } > > What is the correct way to do this ? > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en