LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-21-2003, 01:40 PM   #1
Mohsen
Member
 
Registered: Feb 2003
Location: Iran
Distribution: Solaris 10
Posts: 201

Rep: Reputation: 30
Again C++ questoin


1. does operator `new' throw anything on failure?

2. I have a function which gives a pointer to function (e.g. void (*)(int) ) as its parameter. know I want to call the function with the proper pointer function as argument, but its method of a class. g++ gives me error on this action. See the example:
Code:
void Func (void (*F)(int)) {
  F (3);
}

class CTest {
public:
  void PrintNum (int);
};

CTest::PrintNum (int k) {
  printf ("The number is %d\n", k);
}

main () {
  CTest Test;
  Func (Test.PrintNum (13)); // ERROR :(
}
Also I used whatever casting I could (C-style, reinterpret_cast, static_cast,...) but all of them give me error.

Last edited by Mohsen; 08-21-2003 at 01:50 PM.
 
Old 08-21-2003, 02:07 PM   #2
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
1) yep, bad_alloc

2) i answered this question yesterday, i'll go hunting for the thread
...
here ya go: http://www.linuxquestions.org/questi...threadid=83208

Last edited by kev82; 08-21-2003 at 02:09 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I have a newb questoin... gbdavidx Linux - General 2 11-17-2004 09:57 PM
proftpd questoin compu73rg33k Linux - Software 14 06-25-2004 07:08 PM
little questoin about vimrc..... chunlee Linux - Software 2 06-22-2004 07:06 PM
Stupid Questoin gone15 Linux - Newbie 3 05-15-2004 03:48 PM
Questoin Doddkue Linux - Hardware 1 11-04-2003 10:42 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration