www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/15/13:47:10

From: deepblack AT geocities DOT com (Luís Coelho)
Newsgroups: comp.lang.c++,comp.os.msdos.djgpp
Subject: Re: list.sort(const void*(*fnc)()) again;=)
Date: Wed, 15 Apr 1998 14:10:22 GMT
Organization: Instituto Superior Tecnico
Lines: 37
Message-ID: <3533f431.6208206@news.ist.utl.pt>
References: <6gsv3d$dli$1 AT cadmium DOT aware DOT nl>
NNTP-Posting-Host: ppp08.ist.utl.pt
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Sun, 12 Apr 1998 12:04:31 GMT, authentic AT tip DOT nl (Rick) uttered
the following words:

>Dear c++ programmers,
>
>1. Am I right that when I have instantiated
>   more then one objects of myclass that only
>   one function get_myname and one function
>   get_myid is created(it should be...).

Yes.

<snip>

>int operator<(myclass el1, myclass el2)
>{
>        return (el1.get_myid() < el2.get_myid())<0 ? 0:1;
>}

Why not 

bool operator < (myclass e11, myclass e12);?
^^^^


<snip>

>        //Hier is 'tie nie oke
>        //const void* (myclass::*get_fnc)()const=myclass::get_myname;
>        //lijst1.sort2(get_fnc);

const void* (myclass::*get_fnc) () const = &myclass::get_myname;

I think you always need the & on member functions. Could be
wrong, though.

Hope that helped,

- Raw text -


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