Interface

August 2, 2007 at 1:07 pm (interface)

Interface

    Common Uses of Interface

  •        Interface is used to collect similarities. Wherever we have to implement in the class means follow that similarities  

    Wherever we have to use  

  •           Two person using same code but connection to the database methods only differ to each other. One person use sql based connection another one use oracle based connection. This type of scenario we can use Interface.   

   For Example     

  •          A human  and a parrot can both whistle, however it would not make sense to represent Humans and Parrots as subclasses of a Whistler class, rather they would most likely be subclasses of an Animal class (likely with intermediate classes), but would both implement the Whistler interface

     What is interface

  • The behavior of classes 

  • All methods of an interface are abstract methods 

  • They cannot have bodies 

  • You cannot create an instance from an interface 

  • An interface can only be implemented 

  • This is the concept of encapsulation

  • During runtime, actual object instance is associated

    with the interface type

  • It needs only the interface at the compile time

  • Interface does not contain constructor.

  • It not supports multiple inheritance directly but using interfaces we can achieve multiple inheritance. 

Defining Classes and Interfaces in VB .NET

            Public Class AClass

            End Class

            Public Interface AnInterface

            End Interface 

Implementing Interfaces

             Public Interface AnInterface   

                  Function WhoAmI() As String     

            End Interface  

          Public Class AClass

                   Implements AnInterface

                     Public Function WhoAmI() As String Implements AnInterface.WhoAmI

                            Return “AClass”

                     End Function

         End Class

Advertisements

Permalink Leave a Comment

Abstract Class

August 2, 2007 at 9:29 am (Abstract Class)

     Abstract Class

  •  An abstract class is a class that contains one or more abstract methods
  •  Abstract Class may contain constructor but interface does not contain constructor.
  •  In Interface all methods should be public but not in abstract class
  •  Abstract class we can put sharable code

  • Its not Possible to create instance of Abstract class

  • it cannot be instantiated on it’s own, it must be inherited.

  • Abstract Class can used One Overriding method

  • abstract classes can specify members that must be implemented in inheriting classes

  • a class can inherit only one abstract class

  • How we have to create Abstract Class

    • abstract class must use the MustInherit keyword.

    • An abstract class like all other classes can implement any number of members

    • To declare an abstract member we use the MustOverride keyword

            

Permalink Leave a Comment

Oop Concepts

August 2, 2007 at 6:57 am (Oop Concepts)

    Class  

  •     Class is template for an object    

  •      Class is a collection of methods and attributes

  •  Object

    •        An object is an instance of a Class 

      Modules             

    •    You can use modules to write common functions. 
    •     A Module is a group of functions. Unlike functions in classes, Public functions in  modules can be called directly from anywhere else.
    •    VB provides Functions and Subroutines. Functions and Subroutines are almost the same, but the difference is that a subroutine can’t return a value. 

     Constructor          

    •       A constructor is a method which is invoked when an object of a class is created.
    •      you should use useNew() to create constructors.

    •   Constructors can be overloaded but unlike the functions, the Overloads keyword is not required 
    •   Destuctor

      •  A Destructor is a special function which is called automatically when a class is destroyed

    Permalink Leave a Comment

    Coding Standards

    August 2, 2007 at 4:57 am (Coding Standards)

       A DOCTYPE specification MUST be used at the beginning of the web page

                o A DOCTYPE (short for ‘document type declaration’) informs the validator which version of (X)HTML you’re using, and must appear at the very top of every web page.

                o Doctypes are a key component of compliant web pages: your markup and CSS won’t validate without them.

               o Netscape 6 and above, Internet Explorer 6 on Windows, and Internet Explorer 5 for Macintosh all support DOCTYPE switching

               o  For XHTML strict:   

               (Use this doctype when you’re not using any deprecated or frameset  tags with XHTML.)    

                <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”             “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>  

                 o     For XHTML transitional:  

                (Use this doctype if your document is in XHTML and contains

          deprecated tags.)

                <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”        “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>    

               o  For XHTML frameset: 

               (Use this doctype if your document is in XHTML and contains

          frameset tags and/or deprecated tags.) 

              <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Frameset//EN” http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd”&gt;

           Tags and attributes MUST be in lower case  

                  o  This is because XHTML documents are XML applications. XML is case-sensitive. Tags like <p> and <P> are interpreted as different tags.

          o  <body>
                     <p><a href=”My Link”>This is correct</a></p>
             </body> 

           Elements MUST be nested correctly.

          o  This is wrong:  

                           <p><b>This is not correct</p></b>

          o  This is correct:                                                      

                    <p><b>This is correct</b></p>

        Attribute values SHOULD always be quoted.         

        o    This is wr

                   <table width=640><tr><td>This is not correct</td></tr></table>
         o   This is correct:     
                    <table width=”640″><tr><td>This is correct</td></tr></table>  
         All pages MUST have a page title. This title will match the heading title at the top of the content section.

                 Example:

                         <title>Nevada Department of Transportation Homepage</title>

           

    Permalink Leave a Comment

    web standards

    August 2, 2007 at 4:02 am (Uncategorized)

    • It will describe how a web page should be marked up
    • how the browsers should display those mark-ups
    • What are the benefits of using web standards?A site that has been built to web standards generally will be:
      • Less bandwidth intense
      • Future-proof
      • Extensibility
      • Easier to maintain
      • Compatible with new browsers
      • Accessible

    Permalink 3 Comments