Shared Methods
Shared methods are similar to shared fields and properties in the fact that they are not actions performed on an object, but rather actions performed on the class level that do not require the existence of an object.
If you continue with the example, you may want to add a function that will calculate the price for an unknown product. As it happens in any shop, you might find a product without a label, or with a deteriorated label. In this case the cashier will assign it a list price and will ask for the final price. But because there is no product object that matches the description, you need to provide a mechanism to calculate the price that is not based on an existing product. The solution is to create a shared function that ...
Get Visual Basic® .NET by Example now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.