|
-
Jul 15th, 2004, 10:47 AM
#1
Thread Starter
Hyperactive Member
Inherit a class with a private "New()" sub?
Please forgive me if this is a dumb question but...
I am learing how to extend a class with some properties and methods of my own design. When I create the class code and add the Inherit statement I get this error:
Class 'PourLine' must declare a 'Sub New' because its base class 'LineClass' does not have an accessible 'Sub New' that can be called with no arguments.
When I attempt to add a sub called "New" I get this error:
First statement of this 'Sub New' must be a call to 'MyBase.New' or 'MyClass.New' because base class 'DesignCAD.LineClass' of 'Exploring_Capping_Classes.PourLine' does not have an accessible 'Sub New' that can be called with no arguments.
When I try MyBase.New() the error is:
'DesignCAD.LineClass.Private Sub New()' is not accessible in this context because it is 'Private'.
Is there any way I can create a class that inherits the methods and properties of the base class?
My simple code:
Public Class PourLine
Inherits DesignCAD.LineClass
Sub Build()
MyBase.New()
End Sub
End Class
Thanks in advance for your help.
Eric
-
Jul 15th, 2004, 10:57 AM
#2
Why not make the New in the inherited class protected?
-
Jul 15th, 2004, 11:08 AM
#3
Thread Starter
Hyperactive Member
Like This?
Public Class PourLine
Inherits DesignCAD.LineClass
Protected Sub New()
MyBase.New()
End Sub
End Class
When I do I still get the same error which is:
'DesignCAD.LineClass.Private Sub New()' is not accessible in this context because it is 'Private'.
Thanks,
Eric
-
Jul 15th, 2004, 12:04 PM
#4
No. The class you are inheriting. Assuming you have access to the code to do that. Otherwise, it wasnt designed with being inherited in mind.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|