[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Explain some code.

Posted on 2006-10-30
1
Medium Priority
?
189 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

873 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