| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | #$^%$&%$!!!! |
> What is wrong with the following code? Why won't it accept
> the parameter for qsort?
A non-static class member function is not like a normal function. You can't
mix and match them.
The short answer:
class phone_database {
[..]
/* compare two record_phone objects for sorting purposes */
static int cmp(const void *a, const void *b){
if (**(record_phone**)a > **(record_phone**)b) return 1;
if (**(record_phone**)a < **(record_phone**)b) return -1;
return 0;
}
[..]
> I keep getting "Use :: to take pointer to member function"
> errors, but no matter how many ways I use the :: operator, it
> won't accept the parameter.
Yup.
Consider what a member function is and does, particularly in relation to
the 'this' pointer. 'static' removes these special qualities.
---
* Origin: Unique Computing Pty Ltd (3:632/348)SEEN-BY: 50/99 54/54 620/243 623/630 624/50 632/103 301 348 365 386 998 SEEN-BY: 633/371 379 634/384 635/210 502 503 541 544 636/100 639/100 711/409 SEEN-BY: 711/410 430 807 808 809 932 934 712/623 713/888 714/906 800/1 @PATH: 632/348 635/503 50/99 54/54 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.