Solved

Explain some code.

Posted on 2006-10-30
1
183 Views
Last Modified: 2010-04-16
Can you explain to me
what this section is doing? The override? The base(_id)

        #region Inherited members
        protected override Object CreateInstance(int _id)
        {
            return new ReportTemplate(_id);
        }

        public override DataSet DataSet
        {
            get
            {
                VxDbClient _dbClient = SystemDBConnection.CreateSystemDbClient();
                DataSet _ds = _dbClient.ExecuteStoredProc("RG_sp_GetReportTemplates",
                    new VxDbParameter[] { new VxDbParameter(VxDbType.Sql, "@nvcFilter", "") });
                _ds.Tables[0].TableName = tableName;
                return _ds;
            }
        }

        public new ReportTemplate GetObject(int _id)
        {
            return base.GetObject(_id) as ReportTemplate;
        }
        #endregion

and this to
public class ReportTemplate : Object
    {
        #region Attributes
        private string name;
        private string fileName;
        #endregion

        public ReportTemplate(int _id)
            : base(_id)
        {
        }

        #region Properties
        public string Name
        {
            get
            {
                return name;
            }
        }

        public string FileName
        {
            get
            {
                return fileName;
            }
        }
        #endregion

0
Comment
Question by:mathieu_cupryk
1 Comment
 
LVL 9

Accepted Solution

by:
smidgie82 earned 500 total points
ID: 17834838
Hi mathieu_cupryk,

ReportTemplate is a class that's derived from the Object base class.  For every instance of ReportTemplate, there is an instance of class Object that's associated with it.  So, from within a member of ReportTemplate, "base" refers to the associate instance of class Object.  See the MSDN reference page on the base keyword: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrfbasepg.asp.  Maybe more useful, Google for Object-Oriented programming.  Wikipedia has a good page on it: http://en.wikipedia.org/wiki/Object-oriented_programming

>> public ReportTemplate (int _id) : base(_id)

This is a constructor.  Meaning that whenever an instance of ReportTemplate is created using the syntax:
ReportTemplate my_template (1);
an instance of ReportTemplate is created, and the integer "1" is passed to this constructor.  The base(_id) part is an instruction to use the Object (int _id) constructor of the Object base class, and to pass it _id as its argument.

Cheers!
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question