delorie.com/archives/browse.cgi | search |
From: | "Traveler" <traveler AT netti DOT fi> |
Newsgroups: | comp.lang.c++,comp.os.msdos.djgpp |
Subject: | GENERAL DATA TYPE (Do you need one ?) |
Date: | Tue, 20 Mar 2001 21:14:04 +0200 |
Organization: | SAUNALAHDEN asiakas |
Lines: | 34 |
Message-ID: | <9988r4$k33$1@tron.sci.fi> |
NNTP-Posting-Host: | mkdxxxviii.hdyn.saunalahti.fi |
X-Trace: | tron.sci.fi 985114276 20579 195.197.167.38 (20 Mar 2001 18:51:16 GMT) |
X-Complaints-To: | newsmaster AT saunalahti DOT fi |
NNTP-Posting-Date: | 20 Mar 2001 18:51:16 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 |
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) ? 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...) 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 // The following would be possible... int x = f(); long y = f(); // So would this... int x = 10; int y = 20; Object tmp; tmp = x; x = y; y = tmp; // Now, x has 20 & y has 10 "No matter how many times you fail you will success in the end..." traveler AT netti DOT fi Dark DOT Angel AT saunalahti DOT fi "Traveler2001AD"
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |