Solved

Explain some code.

Posted on 2006-10-30
1
181 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now