Results 1 to 2 of 2
- 11-28-2009, 03:12 PM #1
Member
- Join Date
- Nov 2009
- Posts
- 10
- Rep Power
- 0
Calling a constructor from another one.
How can I call a different version of a constructor from another constructor?Java Code:class Thing { int a_; public Thing(a) { a_ = a; } public Thing() { Thing(0); //This line doesn't work. }
I could put the code in a private helpconstructor function, but I prefer something easier.
- 11-28-2009, 03:42 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,406
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
Constructor call not calling
By Singing Boyo in forum New To JavaReplies: 5Last Post: 06-09-2009, 01:06 AM -
Constructor calling
By ravian in forum New To JavaReplies: 2Last Post: 12-22-2007, 06:53 PM -
Calling constructor of parent class from a constructor
By Java Tip in forum Java TipReplies: 0Last Post: 12-19-2007, 09:10 AM -
Calling constructor of same class from a constructor
By Java Tip in forum Java TipReplies: 0Last Post: 12-19-2007, 09:01 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks