By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,700 Members | 1,473 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,700 IT Pros & Developers. It's quick & easy.

Question Related to Inheritance( multiple)

P: n/a
Hi,

I am looking for the solution to my problem. this is related to inheritance
(Inheriting properties of base class in multiple quantity) . I am writing
code in VB.net language, I am having two classes clsVehicle and clsWheel.
clsWheel has two properties diameter and pressure. clsVehicle has two
properties Name and Make. I want to implement these classes this way

create a object of Vehicle class.

dim Ovehicle as New clsVehicle

Now I want to have a statements like this

implementation code.

Ovehicle.name = "VehicleName"

Ovehicle.make= "VehicleMake"

Ovehicle.wheels.count = 4

Ovehicle.wheel(1).diameter = "100"

Ovehicle.wheel(2).diameter = "100"

Ovehicle.wheel(3).diameter = "100"

Ovehicle.wheel(4).diameter = "100"

What are the properties and other code has to be implemented in these
classes so that I can have all these above statements valid. Can any one
help me writing this code. I am here pasting the code of the class. I have
tried using parameterized properties but I failed. I tried using this
statement inherits clsWheel in cls Vehicle. I also tried creating instance
of clswheel in clsVehicle dim owheel() as clswheel.

Please guide me to achieve this

Public Class clsVehicle

Private mname As String

Private mmake As String

Public Property name() As String

Get

Return mname

End Get

Set(ByVal Value As String)

mname = Value

End Set

End Property

Public Property Make() As String

Get

Return mmake

End Get

Set(ByVal Value As String)

mmake = Value

End Set

End Property

End Class

Public Class clsWheels

Private mDiam As String

Private mpressure As String

Public Property Diameter() As String

Get

Return mDiam

End Get

Set(ByVal Value As String)

mDiam = Value

End Set

End Property

Public Property pressure() As String

Get

Return mpressure

End Get

Set(ByVal Value As String)

mpressure = Value

End Set

End Property

End Class

Tia,

Kishor
Nov 20 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
I don't think that this is inheritance, more of a oo question. anyway heres
wat i do (i do put seperate classes in seperate files so i dont know if this
would give compilation order problems)

in your clsvehicle declare

private wheel1 as new clsWheel

and make a property for it

Public Property wheel() As clsWheel
Get
Return wheel1
End Get
Set(ByVal Value As clsWheel)
wheel1 = Value
End Set
End Property

then you get a Ovehicle.wheel.diameter ...

havent done this w arrays but i think it could be as simple as declaring the
weel1 as an array

hope it helps

eric

"Kishor" <Kp***@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

I am looking for the solution to my problem. this is related to inheritance (Inheriting properties of base class in multiple quantity) . I am writing
code in VB.net language, I am having two classes clsVehicle and clsWheel.
clsWheel has two properties diameter and pressure. clsVehicle has two
properties Name and Make. I want to implement these classes this way

Nov 20 '05 #2

P: n/a
"Kishor" <Kp***@hotmail.com> schrieb
Hi,

I am looking for the solution to my problem. this is related to
inheritance (Inheriting properties of base class in multiple
quantity) . I am writing code in VB.net language, I am having two
classes clsVehicle and clsWheel. clsWheel has two properties diameter
and pressure. clsVehicle has two properties Name and Make. I want to
implement these classes this way


Untested, but it should work: (note: wheel index is zero-based)
Dim Ovehicle As New clsVehicle

Ovehicle.name = "VehicleName"
Ovehicle.Make = "VehicleMake"
Ovehicle.Wheels.Count = 4
Ovehicle.Wheels(0).Diameter = "100"
Ovehicle.Wheels(1).Diameter = "100"
Ovehicle.Wheels(2).Diameter = "100"
Ovehicle.Wheels(3).Diameter = "100"

Public Class clsVehicle
Private mname As String
Private mmake As String
Public ReadOnly Wheels As New clsWheels
Public Property name() As String
Get
Return mname
End Get
Set(ByVal Value As String)
mname = Value
End Set
End Property
Public Property Make() As String
Get
Return mmake
End Get
Set(ByVal Value As String)
mmake = Value
End Set
End Property
End Class

Public Class clsWheels
Private mItems As New ArrayList
Default Public ReadOnly Property Item( _
ByVal Index As Integer) As clsWheel

Get
Return DirectCast(mItems(Index), clsWheel)
End Get
End Property
Public Property Count() As Integer
Get
Return mItems.Count
End Get
Set(ByVal Value As Integer)
If Value = mItems.Count Then Return
If Value < mItems.Count Then
mItems.RemoveRange(Value, mItems.Count - Value)
Else
Dim i As Integer
For i = mItems.Count + 1 To Value
mItems.Add(New clsWheel)
Next
End If
End Set
End Property

End Class

Public Class clsWheel
Private mDiam As String
Private mpressure As String
Public Property Diameter() As String
Get
Return mDiam
End Get
Set(ByVal Value As String)
mDiam = Value
End Set
End Property
Public Property pressure() As String
Get
Return mpressure
End Get
Set(ByVal Value As String)
mpressure = Value
End Set
End Property
End Class
BTW, the question is not about inheritance at all. :-)
--
Armin

http://learn.to/quote
http://www.plig.net/nnq/nquote.html

Nov 20 '05 #3

P: n/a
hi,
Thanks for your immediate reply. I have tried this also. as per your code I
wll get only one object at a time. If I am declaring it as a arry
Your Statement
private wheel1 as new clsWheel
become like this
private wheel1() as new clsWheel
but this is not allowed in vb.net. to do this we have to change code this
way....
private wheel1 As New Hashtable() and the moment you write this it adds
overhead of creating and destroying the objects manually. I want to avoid
this. is there any way which will allow me to achieve this what I said in
first mail.

Tia.
Kishor


"EricJ" <ericRéMo**@ThiSomnipack.be> wrote in message
news:3f**********************@reader0.news.skynet. be...
I don't think that this is inheritance, more of a oo question. anyway heres wat i do (i do put seperate classes in seperate files so i dont know if this would give compilation order problems)

in your clsvehicle declare

private wheel1 as new clsWheel

and make a property for it

Public Property wheel() As clsWheel
Get
Return wheel1
End Get
Set(ByVal Value As clsWheel)
wheel1 = Value
End Set
End Property

then you get a Ovehicle.wheel.diameter ...

havent done this w arrays but i think it could be as simple as declaring the weel1 as an array

hope it helps

eric

"Kishor" <Kp***@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

I am looking for the solution to my problem. this is related to

inheritance
(Inheriting properties of base class in multiple quantity) . I am writing code in VB.net language, I am having two classes clsVehicle and clsWheel. clsWheel has two properties diameter and pressure. clsVehicle has two
properties Name and Make. I want to implement these classes this way


Nov 20 '05 #4

P: n/a
Kishor,
A variation of Armin's sample would be to derive clsWheels (which I will
call WheelCollection) from CollectionBase. Also I will use Wheel instead of
clsWheel.

Public Class WheelCollection
Inherits CollectionBase

Public Sub Add(ByVal wheel As Wheel)
InnerList.Add(wheel)
End Sub

Default Public ReadOnly Property Item(ByVal index As Integer) As
Wheel
Get
Return DirectCast(InnerList(index), Wheel)
End Get
End Property

End Class

Public Class Vehicle

Public ReadOnly Wheels As New WheelCollection

Public Property Name() As String
Get

End Get
Set(ByVal Value As String)

End Set
End Property

Public Property Make() As String
Get

End Get
Set(ByVal Value As String)

End Set
End Property

End Class

Public Class Wheel

Private m_diameter As Integer

Public Sub New(ByVal diameter As Integer)
m_diameter = diameter
End Sub

Public Property Diameter() As Integer
Get
Return m_diameter
End Get
Set(ByVal value As Integer)
m_diameter = value
End Set
End Property

End Class

Public Module MainModule

Public Sub Main()
Dim aVehicle As New Vehicle
aVehicle.name = "VehicleName"
aVehicle.make = "VehicleMake"
aVehicle.Wheels.Add(New Wheel(100))
aVehicle.Wheels.Add(New Wheel(100))
aVehicle.Wheels.Add(New Wheel(100))
aVehicle.Wheels.Add(New Wheel(100))
End Sub

End Module

I changed to names to be more in line with the Framework and the .NET
Developers Guidelines.

http://msdn.microsoft.com/library/de...Guidelines.asp

The CollectionBase wraps an ArrayList for you, so you only need to add your
type safe methods.

Hope this helps
Jay

"Kishor" <Kp***@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

I am looking for the solution to my problem. this is related to inheritance (Inheriting properties of base class in multiple quantity) . I am writing
code in VB.net language, I am having two classes clsVehicle and clsWheel.
clsWheel has two properties diameter and pressure. clsVehicle has two
properties Name and Make. I want to implement these classes this way

create a object of Vehicle class.

dim Ovehicle as New clsVehicle

Now I want to have a statements like this

implementation code.

Ovehicle.name = "VehicleName"

Ovehicle.make= "VehicleMake"

Ovehicle.wheels.count = 4

Ovehicle.wheel(1).diameter = "100"

Ovehicle.wheel(2).diameter = "100"

Ovehicle.wheel(3).diameter = "100"

Ovehicle.wheel(4).diameter = "100"

What are the properties and other code has to be implemented in these
classes so that I can have all these above statements valid. Can any one
help me writing this code. I am here pasting the code of the class. I have
tried using parameterized properties but I failed. I tried using this
statement inherits clsWheel in cls Vehicle. I also tried creating instance of clswheel in clsVehicle dim owheel() as clswheel.

Please guide me to achieve this

Public Class clsVehicle

Private mname As String

Private mmake As String

Public Property name() As String

Get

Return mname

End Get

Set(ByVal Value As String)

mname = Value

End Set

End Property

Public Property Make() As String

Get

Return mmake

End Get

Set(ByVal Value As String)

mmake = Value

End Set

End Property

End Class

Public Class clsWheels

Private mDiam As String

Private mpressure As String

Public Property Diameter() As String

Get

Return mDiam

End Get

Set(ByVal Value As String)

mDiam = Value

End Set

End Property

Public Property pressure() As String

Get

Return mpressure

End Get

Set(ByVal Value As String)

mpressure = Value

End Set

End Property

End Class

Tia,

Kishor

Nov 20 '05 #5

P: n/a
hi,
Thanks It is working ......

Kishor
"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message
news:Ot*************@TK2MSFTNGP11.phx.gbl...
Kishor,
A variation of Armin's sample would be to derive clsWheels (which I will
call WheelCollection) from CollectionBase. Also I will use Wheel instead of clsWheel.

Public Class WheelCollection
Inherits CollectionBase

Public Sub Add(ByVal wheel As Wheel)
InnerList.Add(wheel)
End Sub

Default Public ReadOnly Property Item(ByVal index As Integer) As
Wheel
Get
Return DirectCast(InnerList(index), Wheel)
End Get
End Property

End Class

Public Class Vehicle

Public ReadOnly Wheels As New WheelCollection

Public Property Name() As String
Get

End Get
Set(ByVal Value As String)

End Set
End Property

Public Property Make() As String
Get

End Get
Set(ByVal Value As String)

End Set
End Property

End Class

Public Class Wheel

Private m_diameter As Integer

Public Sub New(ByVal diameter As Integer)
m_diameter = diameter
End Sub

Public Property Diameter() As Integer
Get
Return m_diameter
End Get
Set(ByVal value As Integer)
m_diameter = value
End Set
End Property

End Class

Public Module MainModule

Public Sub Main()
Dim aVehicle As New Vehicle
aVehicle.name = "VehicleName"
aVehicle.make = "VehicleMake"
aVehicle.Wheels.Add(New Wheel(100))
aVehicle.Wheels.Add(New Wheel(100))
aVehicle.Wheels.Add(New Wheel(100))
aVehicle.Wheels.Add(New Wheel(100))
End Sub

End Module

I changed to names to be more in line with the Framework and the .NET
Developers Guidelines.

http://msdn.microsoft.com/library/de...Guidelines.asp
The CollectionBase wraps an ArrayList for you, so you only need to add your type safe methods.

Hope this helps
Jay

"Kishor" <Kp***@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

I am looking for the solution to my problem. this is related to

inheritance
(Inheriting properties of base class in multiple quantity) . I am writing code in VB.net language, I am having two classes clsVehicle and clsWheel. clsWheel has two properties diameter and pressure. clsVehicle has two
properties Name and Make. I want to implement these classes this way

create a object of Vehicle class.

dim Ovehicle as New clsVehicle

Now I want to have a statements like this

implementation code.

Ovehicle.name = "VehicleName"

Ovehicle.make= "VehicleMake"

Ovehicle.wheels.count = 4

Ovehicle.wheel(1).diameter = "100"

Ovehicle.wheel(2).diameter = "100"

Ovehicle.wheel(3).diameter = "100"

Ovehicle.wheel(4).diameter = "100"

What are the properties and other code has to be implemented in these
classes so that I can have all these above statements valid. Can any one
help me writing this code. I am here pasting the code of the class. I have tried using parameterized properties but I failed. I tried using this
statement inherits clsWheel in cls Vehicle. I also tried creating

instance
of clswheel in clsVehicle dim owheel() as clswheel.

Please guide me to achieve this

Public Class clsVehicle

Private mname As String

Private mmake As String

Public Property name() As String

Get

Return mname

End Get

Set(ByVal Value As String)

mname = Value

End Set

End Property

Public Property Make() As String

Get

Return mmake

End Get

Set(ByVal Value As String)

mmake = Value

End Set

End Property

End Class

Public Class clsWheels

Private mDiam As String

Private mpressure As String

Public Property Diameter() As String

Get

Return mDiam

End Get

Set(ByVal Value As String)

mDiam = Value

End Set

End Property

Public Property pressure() As String

Get

Return mpressure

End Get

Set(ByVal Value As String)

mpressure = Value

End Set

End Property

End Class

Tia,

Kishor


Nov 20 '05 #6

P: n/a
Is there a way to design the class WheelCollection as a general class and
instantiate it for a particular type?

I have multiple objects type to store this way and I dont like to rewrite a
colection class for each type.

Thanks,
Crirus
"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message
news:Ot*************@TK2MSFTNGP11.phx.gbl...
Kishor,
A variation of Armin's sample would be to derive clsWheels (which I will
call WheelCollection) from CollectionBase. Also I will use Wheel instead of clsWheel.

Public Class WheelCollection
Inherits CollectionBase

Public Sub Add(ByVal wheel As Wheel)
InnerList.Add(wheel)
End Sub

Default Public ReadOnly Property Item(ByVal index As Integer) As
Wheel
Get
Return DirectCast(InnerList(index), Wheel)
End Get
End Property

End Class

Public Class Vehicle

Public ReadOnly Wheels As New WheelCollection

Public Property Name() As String
Get

End Get
Set(ByVal Value As String)

End Set
End Property

Public Property Make() As String
Get

End Get
Set(ByVal Value As String)

End Set
End Property

End Class

Public Class Wheel

Private m_diameter As Integer

Public Sub New(ByVal diameter As Integer)
m_diameter = diameter
End Sub

Public Property Diameter() As Integer
Get
Return m_diameter
End Get
Set(ByVal value As Integer)
m_diameter = value
End Set
End Property

End Class

Public Module MainModule

Public Sub Main()
Dim aVehicle As New Vehicle
aVehicle.name = "VehicleName"
aVehicle.make = "VehicleMake"
aVehicle.Wheels.Add(New Wheel(100))
aVehicle.Wheels.Add(New Wheel(100))
aVehicle.Wheels.Add(New Wheel(100))
aVehicle.Wheels.Add(New Wheel(100))
End Sub

End Module

I changed to names to be more in line with the Framework and the .NET
Developers Guidelines.

http://msdn.microsoft.com/library/de...us/cpgenref/ht
ml/cpconNETFrameworkDesignGuidelines.asp
The CollectionBase wraps an ArrayList for you, so you only need to add your type safe methods.

Hope this helps
Jay

"Kishor" <Kp***@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

I am looking for the solution to my problem. this is related to

inheritance
(Inheriting properties of base class in multiple quantity) . I am writing code in VB.net language, I am having two classes clsVehicle and clsWheel. clsWheel has two properties diameter and pressure. clsVehicle has two
properties Name and Make. I want to implement these classes this way

create a object of Vehicle class.

dim Ovehicle as New clsVehicle

Now I want to have a statements like this

implementation code.

Ovehicle.name = "VehicleName"

Ovehicle.make= "VehicleMake"

Ovehicle.wheels.count = 4

Ovehicle.wheel(1).diameter = "100"

Ovehicle.wheel(2).diameter = "100"

Ovehicle.wheel(3).diameter = "100"

Ovehicle.wheel(4).diameter = "100"

What are the properties and other code has to be implemented in these
classes so that I can have all these above statements valid. Can any one
help me writing this code. I am here pasting the code of the class. I have tried using parameterized properties but I failed. I tried using this
statement inherits clsWheel in cls Vehicle. I also tried creating

instance
of clswheel in clsVehicle dim owheel() as clswheel.

Please guide me to achieve this

Public Class clsVehicle

Private mname As String

Private mmake As String

Public Property name() As String

Get

Return mname

End Get

Set(ByVal Value As String)

mname = Value

End Set

End Property

Public Property Make() As String

Get

Return mmake

End Get

Set(ByVal Value As String)

mmake = Value

End Set

End Property

End Class

Public Class clsWheels

Private mDiam As String

Private mpressure As String

Public Property Diameter() As String

Get

Return mDiam

End Get

Set(ByVal Value As String)

mDiam = Value

End Set

End Property

Public Property pressure() As String

Get

Return mpressure

End Get

Set(ByVal Value As String)

mpressure = Value

End Set

End Property

End Class

Tia,

Kishor


Nov 20 '05 #7

P: n/a
Crirus,
When we get Whidbey, VS.NET 2004 we will have the ability, it will be called
Generics. Life will be good!!!! ;-)

http://msdn.microsoft.com/vbasic/whidbey/

Specifically the "Sample Chapter on Generics in Visual Basic" document.

The other documents are interesting also.

Hope this helps
Jay

"Crirus" <Cr****@hotmail.com> wrote in message
news:uD**************@TK2MSFTNGP09.phx.gbl...
Is there a way to design the class WheelCollection as a general class and
instantiate it for a particular type?

I have multiple objects type to store this way and I dont like to rewrite a colection class for each type.

Thanks,
Crirus
"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message news:Ot*************@TK2MSFTNGP11.phx.gbl...
Kishor,
A variation of Armin's sample would be to derive clsWheels (which I will
call WheelCollection) from CollectionBase. Also I will use Wheel instead of
clsWheel.

Public Class WheelCollection
Inherits CollectionBase

Public Sub Add(ByVal wheel As Wheel)
InnerList.Add(wheel)
End Sub

Default Public ReadOnly Property Item(ByVal index As Integer) As
Wheel
Get
Return DirectCast(InnerList(index), Wheel)
End Get
End Property

End Class

Public Class Vehicle

Public ReadOnly Wheels As New WheelCollection

Public Property Name() As String
Get

End Get
Set(ByVal Value As String)

End Set
End Property

Public Property Make() As String
Get

End Get
Set(ByVal Value As String)

End Set
End Property

End Class

Public Class Wheel

Private m_diameter As Integer

Public Sub New(ByVal diameter As Integer)
m_diameter = diameter
End Sub

Public Property Diameter() As Integer
Get
Return m_diameter
End Get
Set(ByVal value As Integer)
m_diameter = value
End Set
End Property

End Class

Public Module MainModule

Public Sub Main()
Dim aVehicle As New Vehicle
aVehicle.name = "VehicleName"
aVehicle.make = "VehicleMake"
aVehicle.Wheels.Add(New Wheel(100))
aVehicle.Wheels.Add(New Wheel(100))
aVehicle.Wheels.Add(New Wheel(100))
aVehicle.Wheels.Add(New Wheel(100))
End Sub

End Module

I changed to names to be more in line with the Framework and the .NET
Developers Guidelines.

http://msdn.microsoft.com/library/de...us/cpgenref/ht ml/cpconNETFrameworkDesignGuidelines.asp

The CollectionBase wraps an ArrayList for you, so you only need to add

your
type safe methods.

Hope this helps
Jay

"Kishor" <Kp***@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi,

I am looking for the solution to my problem. this is related to

inheritance
(Inheriting properties of base class in multiple quantity) . I am writing code in VB.net language, I am having two classes clsVehicle and clsWheel. clsWheel has two properties diameter and pressure. clsVehicle has two
properties Name and Make. I want to implement these classes this way

create a object of Vehicle class.

dim Ovehicle as New clsVehicle

Now I want to have a statements like this

implementation code.

Ovehicle.name = "VehicleName"

Ovehicle.make= "VehicleMake"

Ovehicle.wheels.count = 4

Ovehicle.wheel(1).diameter = "100"

Ovehicle.wheel(2).diameter = "100"

Ovehicle.wheel(3).diameter = "100"

Ovehicle.wheel(4).diameter = "100"

What are the properties and other code has to be implemented in these
classes so that I can have all these above statements valid. Can any one help me writing this code. I am here pasting the code of the class. I have tried using parameterized properties but I failed. I tried using this
statement inherits clsWheel in cls Vehicle. I also tried creating

instance
of clswheel in clsVehicle dim owheel() as clswheel.

Please guide me to achieve this

Public Class clsVehicle

Private mname As String

Private mmake As String

Public Property name() As String

Get

Return mname

End Get

Set(ByVal Value As String)

mname = Value

End Set

End Property

Public Property Make() As String

Get

Return mmake

End Get

Set(ByVal Value As String)

mmake = Value

End Set

End Property

End Class

Public Class clsWheels

Private mDiam As String

Private mpressure As String

Public Property Diameter() As String

Get

Return mDiam

End Get

Set(ByVal Value As String)

mDiam = Value

End Set

End Property

Public Property pressure() As String

Get

Return mpressure

End Get

Set(ByVal Value As String)

mpressure = Value

End Set

End Property

End Class

Tia,

Kishor



Nov 20 '05 #8

P: n/a
Ohh, I cant finish a single aplication before they write another Framework?
Just to make me see how much work I've domne and how easy can be done after
a release?

--
Ceers,
Crirus

------------------------------
If work were a good thing, the boss would take it all from you

------------------------------

"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in message
news:O7**************@TK2MSFTNGP12.phx.gbl...
Crirus,
When we get Whidbey, VS.NET 2004 we will have the ability, it will be called Generics. Life will be good!!!! ;-)

http://msdn.microsoft.com/vbasic/whidbey/

Specifically the "Sample Chapter on Generics in Visual Basic" document.

The other documents are interesting also.

Hope this helps
Jay

"Crirus" <Cr****@hotmail.com> wrote in message
news:uD**************@TK2MSFTNGP09.phx.gbl...
Is there a way to design the class WheelCollection as a general class and
instantiate it for a particular type?

I have multiple objects type to store this way and I dont like to rewrite
a
colection class for each type.

Thanks,
Crirus
"Jay B. Harlow [MVP - Outlook]" <Ja********@email.msn.com> wrote in

message
news:Ot*************@TK2MSFTNGP11.phx.gbl...
Kishor,
A variation of Armin's sample would be to derive clsWheels (which I will call WheelCollection) from CollectionBase. Also I will use Wheel instead of
clsWheel.

Public Class WheelCollection
Inherits CollectionBase

Public Sub Add(ByVal wheel As Wheel)
InnerList.Add(wheel)
End Sub

Default Public ReadOnly Property Item(ByVal index As Integer)
As Wheel
Get
Return DirectCast(InnerList(index), Wheel)
End Get
End Property

End Class

Public Class Vehicle

Public ReadOnly Wheels As New WheelCollection

Public Property Name() As String
Get

End Get
Set(ByVal Value As String)

End Set
End Property

Public Property Make() As String
Get

End Get
Set(ByVal Value As String)

End Set
End Property

End Class

Public Class Wheel

Private m_diameter As Integer

Public Sub New(ByVal diameter As Integer)
m_diameter = diameter
End Sub

Public Property Diameter() As Integer
Get
Return m_diameter
End Get
Set(ByVal value As Integer)
m_diameter = value
End Set
End Property

End Class

Public Module MainModule

Public Sub Main()
Dim aVehicle As New Vehicle
aVehicle.name = "VehicleName"
aVehicle.make = "VehicleMake"
aVehicle.Wheels.Add(New Wheel(100))
aVehicle.Wheels.Add(New Wheel(100))
aVehicle.Wheels.Add(New Wheel(100))
aVehicle.Wheels.Add(New Wheel(100))
End Sub

End Module

I changed to names to be more in line with the Framework and the .NET
Developers Guidelines.

http://msdn.microsoft.com/library/de...us/cpgenref/ht ml/cpconNETFrameworkDesignGuidelines.asp

The CollectionBase wraps an ArrayList for you, so you only need to add

your
type safe methods.

Hope this helps
Jay

"Kishor" <Kp***@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> I am looking for the solution to my problem. this is related to
inheritance
> (Inheriting properties of base class in multiple quantity) . I am

writing
> code in VB.net language, I am having two classes clsVehicle and

clsWheel.
> clsWheel has two properties diameter and pressure. clsVehicle has two > properties Name and Make. I want to implement these classes this way >
>
>
> create a object of Vehicle class.
>
> dim Ovehicle as New clsVehicle
>
>
>
> Now I want to have a statements like this
>
> implementation code.
>
> Ovehicle.name = "VehicleName"
>
> Ovehicle.make= "VehicleMake"
>
> Ovehicle.wheels.count = 4
>
> Ovehicle.wheel(1).diameter = "100"
>
> Ovehicle.wheel(2).diameter = "100"
>
> Ovehicle.wheel(3).diameter = "100"
>
> Ovehicle.wheel(4).diameter = "100"
>
>
>
> What are the properties and other code has to be implemented in these > classes so that I can have all these above statements valid. Can any one > help me writing this code. I am here pasting the code of the class. I have
> tried using parameterized properties but I failed. I tried using

this > statement inherits clsWheel in cls Vehicle. I also tried creating
instance
> of clswheel in clsVehicle dim owheel() as clswheel.
>
>
>
> Please guide me to achieve this
>
>
>
>
>
> Public Class clsVehicle
>
> Private mname As String
>
> Private mmake As String
>
>
>
>
>
> Public Property name() As String
>
> Get
>
> Return mname
>
> End Get
>
> Set(ByVal Value As String)
>
> mname = Value
>
> End Set
>
> End Property
>
> Public Property Make() As String
>
> Get
>
> Return mmake
>
> End Get
>
> Set(ByVal Value As String)
>
> mmake = Value
>
> End Set
>
> End Property
>
> End Class
>
> Public Class clsWheels
>
> Private mDiam As String
>
> Private mpressure As String
>
> Public Property Diameter() As String
>
> Get
>
> Return mDiam
>
> End Get
>
> Set(ByVal Value As String)
>
> mDiam = Value
>
> End Set
>
> End Property
>
> Public Property pressure() As String
>
> Get
>
> Return mpressure
>
> End Get
>
> Set(ByVal Value As String)
>
> mpressure = Value
>
> End Set
>
> End Property
>
> End Class
>
>
>
>
>
> Tia,
>
> Kishor
>
>



Nov 20 '05 #9

P: n/a
its called progress ;p
"Crirus" <Cr****@datagroup.ro> wrote in message
news:OP**************@TK2MSFTNGP11.phx.gbl...
Ohh, I cant finish a single aplication before they write another Framework? Just to make me see how much work I've domne and how easy can be done after a release?

--
Ceers,
Crirus

Nov 20 '05 #10

P: n/a
Or the Hamster Wheel ... ;-)
Nov 20 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.