473,473 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Question Related to Inheritance( multiple)

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
10 1206
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
"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
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
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
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
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
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
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
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
Or the Hamster Wheel ... ;-)
Nov 20 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: dirk | last post by:
How can I do this? Table A A B --------------------- John New York John Miami John ... Max London
3
by: Mike Poe | last post by:
Hi, I'm just learning DB2 and I've run in to a problem that I can't answer & I've not found any docs that tell me how to do it. I probably just don't know what I'm looking for, so I hope...
2
by: Daniel | last post by:
I use an Access database to basically take data exports, import them, manipulate the data, and then turn them into exportable reports. I do this using numerous macros, and queries to get the data...
5
by: NOSPAM | last post by:
I want to write a class that has multiple values associate to it public class Person { public string FirstName {get; set;} public string LastName {get; set;} public DateTime Date {get; set;} }...
24
by: Henry J. | last post by:
My app needs to insert thousand value rows into a mostly empty table (data are read from a file). I can either use inserts, or use merge. The advantage of using merge is that in the few cases...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.