vb.net - Use the shadowed property of the derived class in the base class -
i have 2 class, customerservice class
, cellphonecustomerservice
class. cellphonecustomerservic
class derived customerservice
class. cellphonecustomerservice
class shadows customerrepository
property of customerservice
class.
public class customerservice <microsoft.practices.unity.dependency()> _ public property customerrepository isqlrepository set (byval value sqlrepository) _customerrepository = value end set return _customerrepository end end property public sub save(byval cust customer) me.customerrepository.save(object) end sub public function getallcustomers(byval query string) customer me.customerrepository.getallcustomer(byval query string) end sub public function getcustomer(byval id integer) me.customerrepository.getcustomer(object) end sub end class public class cellphonecustomerservice inherits customerservice <microsoft.practices.unity.dependency()> _ public shadow property customerrepository ioraclerepository set (byval value oraclerepository) _customerrepository = value end set return _customerrepository end end property end class
my problem code when create instance of cellphonecustomerservice
class , use save method, getallcustomers
, , getcustomer
function, still uses customerrepository
property of base class , not shadowed customerrepository
property of derived class.
what need when object cellphonecustomerservice
, base class should use shadowed customerrepository
property of cellphonecustomerservice
class if object customerservice
class use own customerrepository
property.