[algogeeks] Function pointer in c++ to subclass member function

2013-03-18 Thread Luciano Junior
Anyone know how to can make un function pointer in c++ to subclass member
function ?

Example

class Class_1
{
void (*nomFunc) (int);
   ...
}

class Class_2: public Class_1
{
void foo (int x);
Class_2 ();
}

Class_2::Class_2 ()
{
  nomFunc = Class_2.foo;
}

Regards,
-- 

Luciano Soares Pinheiro Jr.
Analista desenvolvedor Sr.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [algogeeks] FUNCTION POINTER IN C

2011-09-07 Thread HARISH S.C
Check this

http://andreinc.net/2010/09/30/generic-data-structures-in-c/

On Tue, Sep 6, 2011 at 10:02 PM, Puneet Ginoria punnu.gino...@gmail.comwrote:

 i am getting things in C++ but i need all this to be done in C.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] FUNCTION POINTER IN C

2011-09-06 Thread Puneet Ginoria
i didn't go you..
It will be helpful if you could give me some running example or give me some
link..
Thnx in Advance..

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] FUNCTION POINTER IN C

2011-09-06 Thread HARISH S.C
Hi,
   Google Template classes in c++ (or) generic classes in c++ you will get
lots of example

Regards,
S.C.Harish
Associate Software Engineer,
Cordys RD http://www.cordys.com/,
Hyderabad

On Mon, Sep 5, 2011 at 5:11 PM, kARTHIK R k4rth...@gmail.com wrote:

 For sending the type, you dont have to denote it explicitly. Use templates.

 templatetypename T void func (T *a) {
   // business logic

 }


 I dont think you can pass operators directly.
 For arithmetic operators, you could use something like this : [refer some
 site for exact syntax]

  templatetypename T1, typename T2 void functioname ( T1 *argument, T2
 operation) {

   T1 result = operation(argument[1] , argument[2]);

 }



 main() {

 int a[]={1,2,3,4,5};
 functioname(a, std::multiplierint());


 }

  Karthik R,
 RD Engineer,
 Tejas Networks.



 On Mon, Sep 5, 2011 at 11:52 AM, punnu punnu.gino...@gmail.com wrote:

 I have to pass a general array in a function whose type will also be
 passed and also a function pointer for  or .
 e.g.

 void function(type , type array, pointer for  or )

 how will you write it in C?

 Thanxx in Advance

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] FUNCTION POINTER IN C

2011-09-06 Thread Puneet Ginoria
i am getting things in C++ but i need all this to be done in C.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] FUNCTION POINTER IN C

2011-09-05 Thread punnu
I have to pass a general array in a function whose type will also be
passed and also a function pointer for  or .
e.g.

void function(type , type array, pointer for  or )

how will you write it in C?

Thanxx in Advance

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] FUNCTION POINTER IN C

2011-09-05 Thread kARTHIK R
For sending the type, you dont have to denote it explicitly. Use templates.

templatetypename T void func (T *a) {
  // business logic

}


I dont think you can pass operators directly.
For arithmetic operators, you could use something like this : [refer some
site for exact syntax]

templatetypename T1, typename T2 void functioname ( T1 *argument, T2
operation) {

 T1 result = operation(argument[1] , argument[2]);

}



main() {

int a[]={1,2,3,4,5};
functioname(a, std::multiplierint());


}

Karthik R,
RD Engineer,
Tejas Networks.



On Mon, Sep 5, 2011 at 11:52 AM, punnu punnu.gino...@gmail.com wrote:

 I have to pass a general array in a function whose type will also be
 passed and also a function pointer for  or .
 e.g.

 void function(type , type array, pointer for  or )

 how will you write it in C?

 Thanxx in Advance

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.