Virtual Class methods.

Posts 1–2 of 2 · Page 1 of 1
Virtual Class methods.
Whats the difference between
[PHP]virtual void example() { cout << "example\n"; }[/PHP]
and [PHP]void example() { cout << "example\n"; }[/PHP]

What does [PHP]virtual[/PHP] do?
It makes it virtual, this way you can override it when the class inherits another.
Posts 1–2 of 2 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Talk with us