locked
Abstract Class RRS feed

  • Question

  • User1822407956 posted

    what is the function of abstract class, why design pattern need to build BLL and DAL

    anyone give an example for my reference as I am getting strat to build my web-based  project 

    Sunday, October 24, 2010 8:57 AM

Answers

  • User-952121411 posted

    what is the function of abstract class, why design pattern need to build BLL and DAL

     

    An abstract is designed to be a base class that can not be directly instantiated (using the "new" keyword) and provides a definition of functionality via its methods or even implementation of some base methods. The purpose or usefulness is to define functionality for derived classes to implement or override that ultimately defines the the details of the methods declared in the Abstract base class. So look at the following small code example:

    Public MustInherit Class Engine
    
        MustOverride Sub StartEngine()
    
    End Class
    
    Public Class LawnMowerEngine
        Inherits Engine
    
        Public Overrides Sub StartEngine()
    
            '1. Prime Carb
            '2. Pull Clutch
            '3. Pull Cord
    
        End Sub
    End Class


     

    In the example above the abstract base class defines the method to be implemented by derived classed called "StartEngine". It is up to inheriting classes to implement that method and provide the details on that method.  You might ask how an abstract class differs from an Interface and 2 major points stick out: 1. A class can only inherit 1 class but many Interfaces. 2. An Interface can not define any implementation details like an Abstract class can (base methods in Abstract class).

    Please look at the following (2) links for some more information:

    Abstract Classes:

    http://msdn.microsoft.com/en-us/library/k535acbf(VS.71).aspx

    OOP with VB:

    http://www.startvbdotnet.com/oop/abstract.aspx

    Hope this helps! Smile

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 26, 2010 9:38 AM

All replies

  • User-1618234021 posted

    Hi

    See the following links:


    http://msdn.microsoft.com/en-us/library/sf985hc5(VS.71).aspx [For Abstract Classes]

    http://forums.asp.net/t/1323050.aspx [For DAL and BLL]

    Sunday, October 24, 2010 10:12 AM
  • User-1148431695 posted

    Hi,

    Abstract class is a class that contains a generic level information which can be inherited by specialized classes (child). We are not able to create an instance of abstract class.

    E.g. If we are desiging an application for automobile industry, we can create vehicle/automobile as a generic class that can have properties like engine, steering wheel, doors, etc. Then we can inherit a class called Passenger car/automobile from it which will have its own properties.

    I hope you got the point. You can visit www.dofactory.com for more information on design patterns.


    Sunday, October 24, 2010 11:16 AM
  • User-952121411 posted

    what is the function of abstract class, why design pattern need to build BLL and DAL

     

    An abstract is designed to be a base class that can not be directly instantiated (using the "new" keyword) and provides a definition of functionality via its methods or even implementation of some base methods. The purpose or usefulness is to define functionality for derived classes to implement or override that ultimately defines the the details of the methods declared in the Abstract base class. So look at the following small code example:

    Public MustInherit Class Engine
    
        MustOverride Sub StartEngine()
    
    End Class
    
    Public Class LawnMowerEngine
        Inherits Engine
    
        Public Overrides Sub StartEngine()
    
            '1. Prime Carb
            '2. Pull Clutch
            '3. Pull Cord
    
        End Sub
    End Class


     

    In the example above the abstract base class defines the method to be implemented by derived classed called "StartEngine". It is up to inheriting classes to implement that method and provide the details on that method.  You might ask how an abstract class differs from an Interface and 2 major points stick out: 1. A class can only inherit 1 class but many Interfaces. 2. An Interface can not define any implementation details like an Abstract class can (base methods in Abstract class).

    Please look at the following (2) links for some more information:

    Abstract Classes:

    http://msdn.microsoft.com/en-us/library/k535acbf(VS.71).aspx

    OOP with VB:

    http://www.startvbdotnet.com/oop/abstract.aspx

    Hope this helps! Smile

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 26, 2010 9:38 AM