开发者

Need to Create Abstract Class for Items

开发者 https://www.devze.com 2023-03-22 00:00 出处:网络
I need to create a class for Items? I planned to create it using Abstract Class. So other classes like Stores, Purchase, BOM can use the Items. I need to create some methods in Abstact class like Item

I need to create a class for Items? I planned to create it using Abstract Class. So other classes like Stores, Purchase, BOM can use the Items. I need to create some methods in Abstact class like ItemName, ItemDesc, ItemMake, etc., So that I can use it in any 开发者_开发百科other classes, how to achieve this?


Take a look at this MSDN article explaining how to create abstract classes. And thereafter create derived classes from it.

http://msdn.microsoft.com/en-us/library/sf985hc5.aspx


You should look over at the MSDN for more detailed information, but here's a simple mock:

public abstract class BaseItem
{
    public int ItemId{get;set;}
    public string ItemName{get;set;}
    /* Add additional properties */

    public void PublichSharedMethod()
    {
        /* This method will be publicly available to all derived members and external activators */
    }

    protected void PortectedMethod()
    {
        /* This method will be available only to derived classes */
    }

    protected virtual ProtectedBaseImplementation()
    {
        /* This method will be available only to derived classes, and they can override its behavior */
    }

    public abstract void RequriesImplementation();
        /* This method is publicly available to all, but all derived classes must implement it */

}
0

精彩评论

暂无评论...
验证码 换一张
取 消