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

From: "Traveler" <traveler AT netti DOT fi>
Newsgroups: comp.lang.c++,comp.os.msdos.djgpp
Subject: Re: GENERAL DATA TYPE (Do you need one ?)
Date: Tue, 20 Mar 2001 23:35:34 +0200
Organization: SAUNALAHDEN asiakas
Lines: 55
Message-ID: <998h4d$5o0$1@tron.sci.fi>
References: <9988r4$k33$1 AT tron DOT sci DOT fi> <9989to$s25$1 AT nnrp DOT atgi DOT net>
NNTP-Posting-Host: clxv.xdyn.saunalahti.fi
X-Trace: tron.sci.fi 985122765 5888 195.197.14.165 (20 Mar 2001 21:12:45 GMT)
X-Complaints-To: newsmaster AT saunalahti DOT fi
NNTP-Posting-Date: 20 Mar 2001 21:12:45 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

>
> "...needs to return different kind of types..." : what for?
Only one answer:
Heterogenic doubly-linked list
>
> >
> > 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?
Look above...
>
> >
> > // The following would be possible...
> > int    x = f();
> > long    y = f();
>
> What would that do?
It depends....
What would you like it to do ???

(I certainly know what the "Object& getNode(DWORD index)" will 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'?
That was just an example....
Point is it works and it can handle ALL the basic data types

You can also use it on those of your own work.

The only catch is that A) you have to use inheritance & B) you have to
define conversion function that returns some value from your object

> 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