virtual vs. protected

J

Jeremy Cowles

In VB you have Protected & Overridable, which mean, "visible/callable only
to derrived classes", and "derrived classes may override/replace",
respectfully. Is that roughly the same as protected and virtual in C++? I
have read the definition in VC++ help, but I just want to be 100% positive.


Thanks,
Jeremy
 
V

Victor Bazarov

Jeremy Cowles said:
In VB you have Protected & Overridable, which mean, "visible/callable only
to derrived classes", and "derrived classes may override/replace",
respectfully. Is that roughly the same as protected and virtual in C++? I
have read the definition in VC++ help, but I just want to be 100%
positive.

"protected" access specifier makes the members visible only
to self, to friends, and to derived classes.

"virtual" specifier means it's a special function utilising
run-time type of the object. Virtual functions are known as
"dynamically bound".

I am not sure what it corresponds to in VB, but sounds like
you've found a very close match. Keep in mind that when
different languages are concerned, you can never be "100%
positive".

Victor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,139
Messages
2,570,805
Members
47,356
Latest member
Tommyhotly

Latest Threads

Top