December 15, 2012

Abstract Class


Abstraction is summary of information or providing a relevant information to user or on request as and when required.

Abstraction refers to the act of representing essential features without including the background details or explanations. Classes use the concept of abstraction and are defined as a list of abstract attributes.

Eg : suppose a Student views result online , he got the same but he does not know the process of displaying a result on screen.

abstract public class Car
{
       public Car()
      {
              //
              // TODO: Add constructor logic here
              //
       }

    public string[]  Cartypes()

    {
        string[] sCartypes = new string[]{

            "Sport Car" , "MUV" , "SUV"
        };

        return sCartypes;
    }

     public abstract string  CarCompany();

 }

 

In your code behind page :
        SUV oSuv = new SUV();

        Car oCar = oSuv;

         string sCar = oSuv.CarCompany();

 An abstract class cannot be instantiated.

 

No comments:

Post a Comment