Article View: borland.public.cppbuilder.nativeapi
Article #8800float MyAdd(float A,float B); int MyAdd(int A, int B); both in one DLL
From: Miem Chan
Date: Sat, 05 Jul 2003 04:29
Date: Sat, 05 Jul 2003 04:29
41 lines
2079 bytes
2079 bytes
In C++ it is valid to have two functions with the same name but with
different arguments as shown below;
float MyAdd(float A, float B)
{
return 10*(A+B);
}
int MyAdd(int A, int B)
{
return (A+B);
}
And
float a =1;
float b =2;
float c=0;
c=MyAdd(a,b);
this call will call the first MyAdd function with float arguments and assign
30 to variable "c" (10*(1+2))
And
int a =1;
int b =2;
int c=0;
c=MyAdd(a,b);
this call will call the second MyAdd function with int arguments and assign
3 to the variable "c" (1+2).
There is nothing magic about the these.
The problem (and my question) is how we can put both of these MyAdd
functions in to a single DLL and expect to call proper MyAdd function
depending on the parameters passed ?
Pang Fu
nospam_pangfu@hotmail.com
The first function will be called in
Technical Details
Message-ID:
<3f06547e@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,81e91db7883b82d8,start X-Google-Attributes: gid10cc67,public X-Google-Thread: 10db1e,81e91db7883b82d8,start X-Google-Attributes: gid10db1e,public X-Google-Thread: 102541,81e91db7883b82d8,start X-Google-Attributes: gid102541,public X-Google-ArrivalTime: 2003-07-04 21:39:07 PST From: "Miem Chan" <miemchan@yahoo.com> Newsgroups: borland.public.cppbuilder.nativeapi,borland.public.cppbuilder.oodesign,borland.public.cppbuilder.students Subject: float MyAdd(float A,float B); int MyAdd(int A, int B); both in one DLL Date: Sat, 5 Jul 2003 14:29:45 +1000 Lines: 43 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 210.50.52.188 Message-ID: <3f06547e@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1057379454 210.50.52.188 (4 Jul 2003 21:30:54 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail