Click here to Skip to main content
15,888,733 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Respected sir,
I am new in vb.net windows application..i have following problem in classes

VB
public class person
   private id as int16
   public sub Add()
       'procedure for add new person to database
   end sub

end Class

'another derived class 

public class emp Inherits person
   private id as int16
   public sub Add()
       'procedure for add new employee to database
   end sub
end Class

'at form level coding

dim objemp as new emp
objemp.add()  'here i got error..since both class have same function name
              'and i want same name i dont want to change it..


How can we hide base class function/method of same function name as shown in above example..

Please help me...
Thank you..
Posted

1 solution

In your scenario, you should use the shadows keyword[^].
public class emp Inherits person
   private id as int16
   public Shadows sub Add()
       'procedure for add new employee to database
   end sub
end Class


This keyword hides the implementation of the base class.
 
Share this answer
 
v2
Comments
Sunil Bansode 17-Jul-12 6:20am    
Thank you....!!!
Abhinav S 17-Jul-12 6:24am    
You are welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900