delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/22/04:45:48

From: "Steven S. Falls" <broadview AT earthlink DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Function Pointer Problem
Date: Tue, 22 Dec 1998 01:32:27 -0800
X-Posted-Path-Was: not-for-mail
X-ELN-Date: 22 Dec 1998 09:29:14 GMT
X-ELN-Insert-Date: Tue Dec 22 01:35:11 1998
Organization: EarthLink Network, Inc.
Lines: 37
Mime-Version: 1.0
NNTP-Posting-Host: ip109.san-francisco22.ca.pub-ip.psi.net
Message-ID: <367F672B.E7A3F4CA@earthlink.net>
X-Mailer: Mozilla 4.02 [en]C-DIAL (Win95; U)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi I am trying to get a fuction pointer point to another part of a
class. It compiles but it does not run properly. Any ideas why? and how
to solve the problem?
                thanks,
                    Ardy
                http://www.addr.com/~ardy/

 the code I used was...
#include <stdio.h>
class Wordmake {
   private:
      char word="poop";
      char suff="arro";
      void func1(void);
      void func2(void);
   public:
      Wordmake(void);
      void (*Word)();
      void (*Suffex)();
};
void Wordmake::func1(void) {
   printf("%s",word);
}
void Wordmake::func2(void) {
   printf("%s\n",suff);
}
Wordmake::Wordmake(void) {
   Word=func1;
   Suffex=func2;
   Word();
   Suffex();
}
void main(void) {
    Wordmake Qd;
}



- Raw text -


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