so in such a case that shown in the code (class private members) we must change the member to public or there is other ways ?
If you change to public, there is no point to have get/set methods.
What you need is probably to use a pointer.
If you change to public, there is no point to have get/set methods.
What you need is probably to use a pointer.
can you explian it clearly.I dont understand how a pointer can access a private class member.
can you explian it clearly.I dont understand how a pointer can access a private class member.
//--------------------------- PRUEBA ARRAY PARÁMETRO ENTRADA-SALIDA ---------------- void prueba(string &arPrueba[]) { int k= 0, dim= ArraySize(arPrueba); for(k= 0; k<dim; k++) arPrueba[k]= "prueba"+DoubleToString(k, 0); } //---------------- string array[5]; prueba(array); for(int k=0; k<5; k++) Print(array[k]);
can you explian it clearly.I dont understand how a pointer can access a private class member.
You have to transform you Layer struct into a class as pointer can't be used with struct.
class Layer { //... }; class CNet { private : Layer m_layers[]; public: //. //. //I want a getter function for m_layers Layer *getLayers(int index); }; //and function implementation: Layer *CNet::getLayers(int index) { // todo :index checking return(GetPointer(m_layers[index])); }
and one important question:
is it possible to return an array from a function.
for example :
but it get me several errors . any idea?
I am often using simple wrappers for arrays.
Unlike arrays the wrapper object can be both passed to and/or returned from functions.
class DoubleArrayWrapper { public: /** Wrapped array. */ double value[]; }; DoubleArrayWrapper* w = new DoubleArrayWrapper();
class DoubleArrayWrapper { public: /** Wrapped array. */ double value[]; }; DoubleArrayWrapper* w = new DoubleArrayWrapper();
w.value[index]
plus you are now responsible for releasing the class on unload (but as written, not on deinit/init EA cycles.) Avoid!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
and one important question:
is it possible to return an array from a function.
for example :
but it get me several errors . any idea?