Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
|
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 21st, 2005, 03:37 PM
Authorized User
 
Join Date: Oct 2003
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default Question about Class Inheritance

I have a question about inherited classes. I have a class Days which has properties of days worked. I also have a class Hours which has properties of hours worked. (This might become more clear in the below code).

What I want is to create a Class called "ExemptEmployee", which inherits the Days class, and then set the properties contained in Days from within a method in the ExemptEmployee class. But when I type the "Me" keyword it doesn't work out. Can someone tell me if I'm on the right track with this? TIA!

================================================== =
Public Class ExemptEmployee
        Inherits Days

        Public Shared Sub FetchExemptEmployeeDays()
            'sql fetch which gets the employee days from the Days table in
            'the Timesheet database

            Dim strSQL as String = "SELECT Regular_Days, Vacation_Days, Sick_Days, " & _
                                "Jury_Days, Funeral_Days, Holiday_Days, Unpaid_Days FROM " & _
                                "Days WHERE SSN = '" & s_SSN & "' AND Pay_Period_Number = " & s_PayPeriodNumber

            Dim oConn as New SqlConnection(DSN.FetchDSN(DSN.DataBaseName.Timesh eet))
            Dim oCmd as New SqlCommand
            Dim oReader as SqlDataReader

            With oCmd
                .Connection.Open()
                .CommandText=strSQL
                .CommandType=CommandType.Text
                .Connection=oConn
                oReader = oCmd.ExecuteReader
                While oReader.Read
                    'IN THIS LOOP I WANT TO SET PROPERTIES WHICH WOULD BE INHERITED FROM THE DAYS CLASS.
                End While
            End With

        End Sub

    End Class


================================================== ===========
Public Class Days
            'regular days
            Private dRegularDays as Integer
            'vacation days
            Private dVacationDays as Integer
            'sick days
            Private dSickDays as Integer
            'holiday days
            Private dHolidayDays as Integer
            'jury
            Private dJuryDays as Integer
            'funeral
            Private dFuneralDays as Integer
            'Duty days
            Private dDutyDays as Integer
            'Duty weekends
            Private dDutyWeekends as Integer

        #Region " Property declarations "
                Public Property RegularDays as Integer
                    Get
                        RegularDays = dRegularDays
                    End Get
                    Set
                        dRegularDays = Value
                    End Set
                End Property

                Public Property VacationDays as Integer
                    Get
                        VacationDays = dVacationDays
                    End Get
                    Set
                        dVacationDays = Value
                    End Set
                End Property

                Public Property SickDays as Integer
                    Get
                        SickDays = dSickDays
                    End Get
                    Set
                        dSickDays = Value
                    End Set
                End Property

                Public Property HolidayDays as Double
                    Get
                        HolidayDays = dHolidayDays
                    End Get
                    Set
                        dHolidayDays = Value
                    End Set
                End Property

                Public Property JuryDays as Double
                    Get
                        JuryDays = dJuryDays
                    End Get
                    Set
                        dJuryDays = Value
                    End Set
                End Property

                Public Property FuneralDays as Double
                    Get
                        FuneralDays = dFuneralDays
                    End Get
                    Set
                        dFuneralDays = Value
                    End Set
                End Property

                Public Property DutyDays as Integer
                    Get
                        DutyDays = dDutyDays
                    End Get
                    Set
                        dDutyDays = Value
                    End Set
                End Property

                Public Property DutyWeekends as Integer
                    Get
                        DutyWeekends = dDutyWeekends
                    End Get
                    Set
                        dDutyWeekends = Value
                    End Set
                End Property
        #End Region


        End Class




"A spirit with a vision is a dream with a mission"
__________________
\"A spirit with a vision is a dream with a mission\"





Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Class and Multiple inheritance deepthraj BOOK: Professional C#, 2nd and 3rd Editions 1 May 23rd, 2006 12:57 PM
object class and multiple inheritance deepthraj General .NET 5 August 13th, 2005 10:12 AM
Question about Inheritance in classes forkhead VB.NET 2002/2003 Basics 1 March 21st, 2005 06:54 PM
Newbie question on the 2nd ed: Class inheritance elde BOOK: Professional C#, 2nd and 3rd Editions 0 December 9th, 2004 03:00 AM
base class inheritance krunch97 VB.NET 2002/2003 Basics 6 April 23rd, 2004 11:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.