Problem with abstract class and method !


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Problem with abstract class and method !

  1. #1
    Join Date
    Oct 2009
    Posts
    8

    Problem with abstract class and method !

    After I change to use abstract class on my Insurance class. I go a Array bounds cannot appear in type specifiers on code "Dim i As Insurance(tTypeOfInsurance)" how can I fix it

    Code:
    Public MustInherit Class Insurance
       ........
    End Class
    Code:
        Sub Main()
            Dim tTypeOfInsurance As String
            Console.Write("Enter a Insurance Type [H] for Health, [L] for Life :")
            tTypeOfInsurance = Console.ReadLine
            Dim i As Insurance(tTypeOfInsurance)
            i.display()
        End Sub

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Try changing it to Dim i As New Insurance(tTypeOfInsurance), then change the Insurance constructor to accept a type parameter.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Oct 2009
    Posts
    8
    deleted
    Last edited by tking88; 12-14-2009 at 03:17 PM.

Similar Threads

  1. Objects disposed incorrectly
    By Osiris43 in forum .NET
    Replies: 1
    Last Post: 08-04-2006, 12:15 PM
  2. Replies: 3
    Last Post: 04-26-2006, 04:20 AM
  3. Replies: 1
    Last Post: 04-13-2006, 04:57 AM
  4. JDOM Classpath Help Required
    By kpandya in forum Java
    Replies: 5
    Last Post: 01-15-2006, 07:10 PM
  5. Abstract class
    By Manika in forum Java
    Replies: 1
    Last Post: 09-06-2000, 01:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center