R
RSH
Hi,
I have been construction a sample application to further my growth in
applying OOP concepts in .Net.
My code is structured like this:
Person |-- Employee
|--- Customer
CatalogItems
Order
OrderLineItems
So my instantiation looks like this:
Dim i1 As CatalogItems = New CatalogItems(100, "Bottle", 19.95)
Dim i2 As CatalogItems = New CatalogItems(200, "Can", 10.95)
Dim i3 As CatalogItems = New CatalogItems(300, "Box", 22.95)
Dim c1 As Customer = New Customer(11111111, "Jim Williams", "123 Main St.",
"Atlanta", "GA", "30188")
Dim c2 As Customer = New Customer(12212221, "Fred Smith", "445 Fieldstone
Pkwy", "Royal Oak", "MI", "48098")
Dim no1 As Order = New Order(1000, c1, Now())
no1.AddLineItem(i1, 23)
no1.AddLineItem(i3, 12)
no1.PrintInvoice()
My question revolves around inheritance. When i create a New Order Object,
I am passing it a customer object. The dynamic nature of this is evident
when I create a new order the customer object becomes part of the of the
order. If I change the property FIRST_NAME from Jim to James for example it
progates down to the order as well. Is there anyway to freeze certain
properties in the customer object so that any changes to the FIRST_NAME
Property only affect the main class...not the sub clasess?
I have been construction a sample application to further my growth in
applying OOP concepts in .Net.
My code is structured like this:
Person |-- Employee
|--- Customer
CatalogItems
Order
OrderLineItems
So my instantiation looks like this:
Dim i1 As CatalogItems = New CatalogItems(100, "Bottle", 19.95)
Dim i2 As CatalogItems = New CatalogItems(200, "Can", 10.95)
Dim i3 As CatalogItems = New CatalogItems(300, "Box", 22.95)
Dim c1 As Customer = New Customer(11111111, "Jim Williams", "123 Main St.",
"Atlanta", "GA", "30188")
Dim c2 As Customer = New Customer(12212221, "Fred Smith", "445 Fieldstone
Pkwy", "Royal Oak", "MI", "48098")
Dim no1 As Order = New Order(1000, c1, Now())
no1.AddLineItem(i1, 23)
no1.AddLineItem(i3, 12)
no1.PrintInvoice()
My question revolves around inheritance. When i create a New Order Object,
I am passing it a customer object. The dynamic nature of this is evident
when I create a new order the customer object becomes part of the of the
order. If I change the property FIRST_NAME from Jim to James for example it
progates down to the order as well. Is there anyway to freeze certain
properties in the customer object so that any changes to the FIRST_NAME
Property only affect the main class...not the sub clasess?