hi all,

I have a class A that has a char* var, operator and methods.
In addition I have a global func(char*s). I would like to run this code from the main function by adding operators to my class, I need help writing them.

A* pA; 
A** ppA = pA; 


Hi BanKuZ, welcome to DaniWeb!

Which operator would you like to use? Maybe you can also post your class structure, I'm not sure I followed what is going on from what you posted.


Thank you for the fast replay,
I already have a MYclass* to char* conversion operator on the code and it work fine.
I having problems to convert from MYclass* to MYclass** and from MYclass* to char*.
I need them all to work simultaneously.

My class is very simular to this one:

class Mystring {
	char *s;
	Mystring(const char *);
        Mystring operator=(const char* str)

           strcpy (s, str);
           return *this;
            operator char *()//Conversion operator
                return this->name; 

Thank you for your help.

Edited 5 Years Ago by BanKuZ: n/a

A dataType** is a pointer to a pointer to an instance of dataType (2-levels of indirection instead of 1).

int myInt = 150;
int *pMyInt = &myInt;
int **ppMyInt = &pMyInt;

You'll have to write your converter to return a pointer to the pointer you are trying to convert.

Edited 5 Years Ago by Fbody: n/a

I know, tried these two:

Mystring** operator=( Mystring* A) 
		Mystring** ppTemp= &A;
		return ppTemp;
	operator Mystring **()//Conversion operator
        return *this; 

It didn't work. Am I doing something wrong?

This article has been dead for over six months. Start a new discussion instead.