What is the purpose of Virtual member in C++? -



What is the purpose of Virtual member in C++? -

i don't see purpose of virtual fellow member in class other safety. there other reasons utilize virtual when designing implementations? edit: erased variable part.

there no such thing virtual variable, virtual function or virtual inheritance. such, lack of purpose such thing seems rather thing.

edit: virtual functions how c++ implements run-time polymorphism. trying explain uses/purposes of polymorphism bit beyond fit reasonable-sized post. general idea, however, can define type of behavior in base of operations class, implement behavior differently in each derived class. more practical illustration most, consider base of operations database class defines things finding set of records fit criteria. can implement behavior 1 way sql database (by generating sql), , with, say, mongodb. implementation 1 quite bit different other, viewed abstractly they're still both doing same basic things (finding/reading/writing records).

c++ virtual

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -