Suppose if I am trying to access a method of a class through some other class like this
class SuperClass
{
public interface ISubject
{
void Print();
}
private class Subject : ISubject
{
public void Print()
{
Console.WriteLine("this is a print");
}
}
public class Proxy {
ISubject subject;
public void CallOtherMethod() {
subject = new Subject();
subject.Print();
}
}
}
class Client: SuperClass
{
static void Main() {
Proxy proxy = new Proxy();
proxy.CallOtherMethod();
}
}
is this called as a proxy Class? or does it Require to have a interface as an reference then we have to call the method? for instance like this
class SuperClass
{
public interface ISubject
{
void Print();
}
private class Subject : ISubject
{
public void Print()
{
Console.WriteLine("this is a print");
}
}
public class Proxy : ISubject
{
ISubject subject;
public void Print()
{
subject = new Subject();
subject.Print();
}
}
}
class Client : SuperClass
{
static void Main()
{
ISubject proxy = new Proxy();
proxy.Print();
}
}