Download MetaTrader 5
To add comments, please log in or register
Follow the news. View our company's official channel!
Abejorro
165
Abejorro 2015.03.03 23:32 

Hello again,

sounds simple but it didn't work:

1) class A has a public-function and it's body - working !

2) class B derives class A, function of class A is directly available and working !

3) in my indicator is a instance of class B, the public function of Class A is visible again, tells me its signature, everthing looks good. - But the compiler is crying: "'A::function…' - cannot call private member function" ????? But it isn't declared as private.


I hope you can get my trouble with this few words. And i hope, there is a simple thing to tell the compiler taking the function as public. Same as declared in the instance. To double the body or a code-through will kill my easy design.


EDIT - here with a abstract of code

_______________________________
class A
  {
private:

public:
                     int getData() {return 12;};
  ...
  }

_______________________________

class B : A
  {
  ...
  }  

_______________________________

B objTest;

int t = objTest.getData();   // This line makes me trouble...



Thanks in advance !

Alain Verleyen
Moderator
28672
Alain Verleyen 2015.03.03 23:35  
You are expecting coding help without posting code ?
Abejorro
165
Abejorro 2015.03.03 23:39  
angevoyageur:
You are expecting coding help without posting code ?
That's what i was afraid of... I will try to reduce the stuff to be readable in time :-)
Alain Verleyen
Moderator
28672
Alain Verleyen 2015.03.03 23:54  
If the compiler is saying that your method is private, there is 99.999% chance it is. Check your code.
Abejorro
165
Abejorro 2015.03.03 23:59  
angevoyageur:
If the compiler is saying that your method is private, there is 99.999% chance it is. Check your code.

come on, this is crule. I checked it a minute ago. It's NOT working on my system. The code above with remarks.

class A
  {
private:

public:
                     int getData() {return 12;};
  }
;
//_______________________________

class B : A
  {
  }  
;

//_______________________________

B objTest;

int t = objTest.getData();   // ERROR: 'A::getData' - cannot call private member function	texxx.mq4	35	17

Alain Verleyen
Moderator
28672
Alain Verleyen 2015.03.04 00:06  
Abejorro:

come on, this is crule. I checked it a minute ago. It's NOT working on my system. The code above with remarks.


class B : public A
Abejorro
165
Abejorro 2015.03.04 00:19  
angevoyageur:

Ahhhh, yes that's it ! - Thanks a lot ! - - *g* I'm missing your LOL ;-)
Alain Verleyen
Moderator
28672
Alain Verleyen 2015.03.04 00:25  
Abejorro:
Ahhhh, yes that's it ! - Thanks a lot ! - - *g* I'm missing your LOL ;-)
I removed it as I missed the point at first. ;-)
/
To add comments, please log in or register