I\'m used to scripting languages. PHP, Javascript etc. and I\'ve written a few relatively simple Java and C# apps. This is a question I\'ve repeatedly needed an answer for,
Function A would be part of a class (call it C). Function A could then store the logon credentials and provide a function (or in C#, a property) to obtain the credentials. When they are required, you can simply use the property to obtain the stored credentials and pass them into Function B (on a different class).
class C
{
public void functionA()
{
credentials = obtainCredentials;
}
private LogonCredentials _logonCredentials = null;
public LogonCredentials logonCredentials
{
get { return _logonCredentials; }
}
}
class D
{
public void functionB(LogonCredentials credentials)
{
//do stuff
}
}
///other stuff
///other function ...
...
instanceC = C();
instanceC.functionA();
///more stuff here
instangeD = D();
instanceD.functionB(instanceC.logonCredentials);