Webfort

Webfort

  • 1.7k
  • 62
  • 2.4k

Re factoring of code

Jan 21 2015 8:26 AM
I was wondering if anyone could help.
 
I'm currently re factoring some code and wondering what is the best way to go about it. I currently have one class file which performs a number of actions and need authentication to do so.
 
What I want to do is only authenticate once across both classes
 
public class Authentication
 
public class Class1
 
public class  Class2
 
I was thinking of using Authentication as a base class so
 
public class Class1 : Authentication
 
public class  Class2 : Authentication
 
If I do the above, both classes will authenticate.
 
Is there away I would only have to authenticate once across both objects, and if I need to re authenticate do the same?