User Profile
Collapse
-
ok let me know if u remember... thanx...... -
-
Hi ...
I want to assign the address of variable i to ptr(template type) and then display the value using ptr... any idea how to do that ??...Leave a comment:
-
already went through this link ... didnt find anything related to this problem......Leave a comment:
-
Array of pointers to functions doesn't work here because the functions are of different types (arguments are of different types).... Please suggest any other way......Leave a comment:
-
Hello ....
Can you just give me the syntax of how to do that ...
i have created
template <class T>
T * ptr;
main()
{
int i =10;
//Here i want to assign the address of i to ptr & display value using ptr
float j = 20.23;
//here i want to assing the address of j to ptr & display value using ptr
return 0;
}...Leave a comment:
-
Template Pointer Type....
Hello Folks...
Just going through the templates... found one good question worth sharing
C++ allows the syntax type
template <class T>
T * ptr;
can this ptr be used to point to types likes int variable or float variable
ex: int i =10;
ptr = &i;
If this can be done plz share the syntax of doing it...
Comments will be apprec... -
Run time function call problem
Hello Folks!!!!!
Here is a question ...
I have two functions
void fun1(int i )
{
printf("%d",i);
}
void fun2(float f)
{
printf("%f",f);
}
I want to call the fun1 if the user-input is 1 and fun2 if the user-input is 2
I need to do this without using if-else, switch or conditonal operators... Any way to accomplish... -
As you can see in the example i need a generic pointer to member functions and not ordinary functions.... and its possible to have a pointer to member function which can point to the members functions with same return and argument list....
example int (abc:: * ptr2fun1)();
Here this ptr2fun1 can point to the member functions of class abc whose return type is int and paramet list is empty.
But my question...Leave a comment:
-
Generic pointer to a member functions of a class
Hello Folks!!!!
i have one interesting question over here ..........
Is it possible to create a generic pointer (generic pointer to member functions) which can point to all the member functions of a class
Ex : [code=cpp]class abc()
{
int fun1(int a)
{
//Body of fun1
}
float fun2(float a)
{
//Body of fun2
}...
No activity results to display
Show More
Leave a comment: