Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #8558
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!news.cgarbs.de!news.addix.net!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail |
|---|---|
| From | Philipp Kraus <philipp.kraus@flashpixx.de> |
| Newsgroups | comp.lang.java.programmer |
| Subject | generic constructor call with concret type |
| Date | Wed, 5 Oct 2011 09:48:22 +0200 |
| Organization | 1&1 Internet AG |
| Lines | 55 |
| Message-ID | <j6h246$uhn$1@online.de> (permalink) |
| NNTP-Posting-Host | p3ee28ca0.dip0.t-ipconnect.de |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-1; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Trace | online.de 1317800902 31287 62.226.140.160 (5 Oct 2011 07:48:22 GMT) |
| X-Complaints-To | abuse@einsundeins.com |
| NNTP-Posting-Date | Wed, 5 Oct 2011 07:48:22 +0000 (UTC) |
| User-Agent | Unison/2.1.5 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8558 |
Show key headers only | View raw
Hello,
I have th following proble:
abstract baseclass<T extends Number> {
abstract T dosomething();
}
class runclass<T extends Number> implements baseclass<T>{}
Now I would only implementate the runclass<T> for the datatype Double
and Float on other Number-types the compiler
should create an error.
At next I use a inner interface and class like
class runclass<T extends Number> implements baseclass<T>{
private interface innerintface<L extends Number>
{
public L doanother();
}
// and implement the interface with inner classes
private class floatrun implements innerintface<Float>
{
}
private class doublerun implements innerintface<Double>
{
}
// use a private member to store the object
private innerintface<T> obj = null
public runclass() {
// here is my problem to decide if I need create the obj = new
floatrun() or obj = new doublerun();
}
}
My runclass<T> should be only work with Double or Float datatypes at
the moment. In C++ template
I would create the conrect implement types and a genereal type that
creates an assert. Can I do anything
like
class runclass<T only Double>?
Thanks
Phil
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar
generic constructor call with concret type Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-10-05 09:48 +0200
Re: generic constructor call with concret type Robert Klemme <shortcutter@googlemail.com> - 2011-10-05 02:22 -0700
Re: generic constructor call with concret type Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-10-05 11:58 +0200
Re: generic constructor call with concret type Robert Klemme <shortcutter@googlemail.com> - 2011-10-05 22:14 +0200
csiph-web