Interface & Implementation

J Ramesh Kumar rameshj at adventnet.com
Fri Dec 12 05:37:26 EST 2008


Hi, 

I am new to python. I require some help on implementing interface and its implementation. I could not find any sample code in the web. Can you please send me some sample code which is similar to the below java code ? Thanks in advance for your help.

............
public interface MyIfc
{
    public void myMeth1();
    public void myMeth2();
}
....
public class MyClass implements MyIfc
{
      public void myMeth1()
      {
          //do some implementation
      }

     public void myMeth2()
       {
           //do some implementation
       }
}
...

MyClass myc=new MyClass();
Hashtable hash=new Hashtable();
hash.put("MYIFC",myc);
........
MyIfc myi=(MyIfc)hash.get("MYIFC");
myi.myMeth1();
myi.myMeth2();
.........

Thanks,
Ramesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20081212/2dcf2aea/attachment-0001.html>


More information about the Python-list mailing list