delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/03/20/14:16:49

From: "Victor Bazarov" <vAbazarov AT dAnai DOT com>
Newsgroups: comp.lang.c++,comp.os.msdos.djgpp
Subject: Re: GENERAL DATA TYPE (Do you need one ?)
Date: Tue, 20 Mar 2001 11:09:43 -0800
Organization: Advanced Telcom Group Inc. Internet Services
Lines: 53
Message-ID: <9989to$s25$1@nnrp.atgi.net>
References: <9988r4$k33$1 AT tron DOT sci DOT fi>
NNTP-Posting-Host: 64-42-102-2.atgi.net
X-Trace: nnrp.atgi.net 985115384 28741 64.42.102.2 (20 Mar 2001 19:09:44 GMT)
X-Complaints-To: abuse AT atgi DOT net
NNTP-Posting-Date: 20 Mar 2001 19:09:44 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Traveler" <traveler AT netti DOT fi> wrote...
> Hi to all !
>
> I have only one (and maybe a stupid ?) question:
> Do you have a need for an general data type (something like the
"Object" in
> Java) ?

I have only one (maybe stupid) answer: No, _I_ don't.

> Currently the only thing I see this could be used is in a function
that has
> no parameters but still needs to return different kind of types
(template is
> not a solution here...)

"...needs to return different kind of types..." : what for?

>
> Example:
>
> Object    f(void);    // Function overloading is not possible if only
the
> return value changes
>                             // int f(void), short f(void), etc... are
not
> possible

Yes.  So?

>
> // The following would be possible...
> int    x = f();
> long    y = f();

What would that do?

> // So would this...
> int    x = 10;
> int    y = 20;
> Object    tmp;
> tmp = x;
> x = y;
> y = tmp;    // Now, x has 20 & y has 10

Why can't 'tml' be 'int'?

Victor
--
Please remove capital A's from my address when replying by mail



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019