Calling member function with a function called within a member function

The problem: Is it in some way possible to call a member function within a function that is called within another member function, without added the object in the headers? I have tried to use the this pointer, but that's invalid use. I am currently using Dev-C++.
The first function is the normal function, below is the memberfunction I want to call within this function. Below that is the first memberfunction that is called in via main (another file) with the function: chooseForFilling (ABC, 3); which is a onedimensional array with objects of my class. In that function the user can choose either A, B or C and with one of the objects in the array the first member function is called.
The place where I want to call this another member function is in bold, now commented as it doesn't work the way it is.

Background information: These functions are part of a program that allows the user to do arithmetic on numbers greater than intmax via pointers. k is the number of digits within each 'compartment' (a class). My class bignumber consists of an integer with the number of comparments, a pointer to the first compartment and a pointer to the last compartment.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//finding numbers in the input
int readnumber () {
  char input;
  int number = 0;
  int i = 0;
  //finding the first digit
  do {
    cin.get (input);
  } while (!digit (input));
  //read for the following digits
  do {
    if (digit (input)) {
      number = (number * 10) + (input - 48);
      i++;
      if (i % k == 0) {
        //putoend (number);
        number = 0;
      }
    }
    cin.get (input);
  } while (input != '\n');
  return 0;
} //readnumber


void bignumber::fillingin () {
  cout << "What value do you want to give this number? I must give a multiple "
          "of " << k << ". If not, the last digits will be ignored.\n>> ";
  readnumber ();
}


Thanks,
Last edited on
You can pass a pointer or reference to the object to the readnumber() function.
Or you can make readnumber() a member function.
I was hoping there was a way to do this. Usually when I have something on my mind I want to know how to do it in case I come across something similar in a later stadium. Anyway, thanks Peter, I will just make fillingin and readnumber one and the same memberfunction. There is no actual reason not to do so.
Topic archived. No new replies allowed.