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.
//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 ();
}
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.