Friday 23 November 2012

INTERFACE CANST.......

 PROGRAM 1:
       Create program for making an interface Myinter that get linked with a details resource and recover the details from the details resource.

//interface example - connecting to any database
interface Myinter
{
     gap weblink ();  //abstract public
     gap remove ();
}

class oracleDB uses Myinter
{
     group gap connect()
       {
           program.out.print/n("connecting to oracle details resource...");
        }
   group gap disconnect()
      {
          program.out.print/n("disconnect from oracle");
       }
}

class SybaseDB uses Myinter
{
        group gap connect()
        {
             program.out.print/n("connecting from Sybase");
          }
           group gap disconnect()
            {
                System.out.print/n(disconnected from Sybase");
             }
}
class interfacedemo
{
  group set gap main(string args[]) blows Exception
    {
        //accept the performance classname from commandline argument
       //and store it in the product c.
        classification c=class.forName(args [0]);

      //create products to the classification whose name is in c.
      //let the recommendations different of interface aspect to it.
      Myinter mi =(MyInter)c.newInstance();

      ///call methods of the product using mi.
      mi.connect();
      mi.disconnect();
      }
}

OUTPUT:
C:\> javc interfaceDemo.java
C:\> coffee interfaceDemo oracleDb


connecting to oracle details resource..
Disconnected from oracle

C:\> coffee interfaceDemo sybaseDB
connecting to Sybase database
disconnected fromSybase
     In past program the efficiency classes oracleDB and Sybase DB are required to be provided by third party suppliers. An product to oracleDB or SybaseDB is developed and connect() and disconnect() methods are known as by using Myinter recommendations mi. There are two more problems in the past program the first one why third party suppliers provide performance classes for our interface? they definitely deliver performance classes because it is effective for them every client who ever purchases our program (interface) will certainly buy the performance classes from the third party resource because they want to use our sleek ware in connection with the details resource thus the third party distributors can provide the performance classes.

        The second is how the third party suppliers know which methods to implementation? the third party people know which interface we had written and which methods were released along with their details though API (Application growth interface) documents. API documents is a extremely released written text markup language (html) details computer file that contains the details of all the operate of software a product or a engineering. After creating this method we make an API documents which like a recommendations information to the third party suppliers to understand which strategy to uses.

No comments:

Post a Comment