Hi, I am trying to understand polymorphism and if it can help me in this situation. I have a third party framework that handles Secure FTP functions. Within this framework I am working with two main classes (FTP) which handles FTPSSL over http, and (SFTP) which handles accessing the secure FTP server over the file system. What I would like to do is wrap both of these FTP classes so that I have one class that I would instantiate and in the constructor pass in which type of ftp access i need. It in turn in the constructor instantiate a class level variable that I can use throughout my class methods without having to cast back and forth from object. My instincts tell me that I can use polymorphism somehow, but I can't figure it out. If you need more info, please let me know.

My wapper class would look something like this: however declaring it as object forces me to cast back to SFTP or FTP everytime I use it which defeats the purpose of making the variable name loosely coupled with the methods in my class.

#
public class myFTPHandler
{
private object ftpHandler;

public enum FTPType
{
FTP,
SFTP
}

public myFTPHandler(FTPType ftpType)
{
switch(ftpType)
{
case FTPType.FTP:
ftpHandler = new SFTP();
break;
case FTPType.SFTP:
ftpHandler = new SFTP();
break;
default:
break;
}
}

public void MyMethod1(string userName, string password)
{
ftpHandler.Login(userName, password);
}
}
#