I am a newbie in C++ and now I am writing some codes to practice. My question may be stupid and I have tried to search for answers but what I found are not in my case (I think so, probably I am so limited to my knowledge in C++..). Okay my problem is:
I have a main function which looks like:
#include "LoadMedia.h"
#include "Parser.h"
#include "Runner.h"
#include <string>
int main(int argc, char*argv[])
{
LoadMedia script = LoadMedia(); // initialize an object of class LoadMedia
script.loadScript("myscript.efa"); // loadScript is a function defined in class LoadMedia
script.Parse(); // Parse is a function defined in class Parser, class LoadMedia is inheritaged from class Parser
Runner tempRunner = Runner(); // initialize an object in class Runner
tempRunner.Eval(); // Eval is a function defined in class Runner
...... // some other codes....
}
When calling the function
Parser::Parse()
I will get some values (int, string, double) and the function
Runner::Eval()
will need these values to do some evaluation.
I was wondering how to save the values obtained from Parse() somewhere where Eval() can also access these values easily...I am thinking whether I can use pointer or reference but I have no idea how to do it since I am so new in c++....Any ideas?