troubleshooting Question

How do you declare a "MustOverride" Constant?

Avatar of Javin007
Javin007Flag for United States of America asked on
Visual Basic.NET.NET Programming
6 Comments3 Solutions1136 ViewsLast Modified:
Okay, I'm painfully new to TRUE OOP programming, and am working with inheritance.  I have a constant that I want each child class to be forced to set, so that in the base class a common method can be run that uses the value as set by its children.

I've tried the following:

Protected MustOverride Const Foo As Long

But needless to say, VB.Net no likey.  

I've come to the conclusion that I can create a regular variable in the base class, then make a required sub that "sets" the value of the variable, but this definitely feels like a hack.

Join our community to see this answer!
Unlock 3 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros