I have this situation: I need class2(string)
constructor to only be accessible from within the class1
methods and not from external classes:
public class class1
{
public void access()
{
//want to make class2(string) be accessible only from here
}
public class class2
{
public class2()
{
}
private class2(string p)
{
}
}
}
I'm trying to validate a user, the class2()
create an empty instance of the user class while the class2(...)
login the user. now I have class1 login method access that can be called from my pages, and i dont want that any of my pages directly calls my class2(...)
login but must all pass from class1.access()
that returns the class2
with user informations.
edit: the purpose of this is to create a safe login procedure, I do not want to expose my login and make it accessible directly from my pages, I want that my pages pass from the logic of class1.access()
which will make considerations on how/if to login a user and return and empty class2
if the login fail with also class2.valid=false;
or will return a class2
with all the informations from the user. I need to access and create and empty class2
from my pages since I pass it as out
param in my class1.access(login_credentials credentials, out class2 user_data)