Code:
import std.stdio;
class T1 {
protected:
void _apply() {
writeln("Call T1");
}
}
class T2 : T1 {
public:
override void _apply() {
writeln("Call T2");
}
}
class T3 : T1 {
protected:
override void _apply() {
Same with private, of course.
On 2013-09-12 11:28, Namespace wrote:
But if I try to write 'override' before [1], I get this error message:
Error: function T4._apply cannot override a non-virtual function
This seems inconsistent. I really overwrite the method, and then I put
it in a package label.
I think the error message
On Thursday, 12 September 2013 at 11:29:22 UTC, Jacob Carlborg
wrote:
On 2013-09-12 11:28, Namespace wrote:
But if I try to write 'override' before [1], I get this error
message:
Error: function T4._apply cannot override a non-virtual
function
This seems inconsistent. I really overwrite the
On 2013-09-12 13:34, Namespace wrote:
Obvious. But what happend? Is the original _apply hidden?
If you call through an object of the same type, T4 in this case, the
method in the base class is hidden. If you call through a base class
reference, T1 in this case, the "_apply" method in the sub
On 2013-09-12 13:39, Jacob Carlborg wrote:
If you call through an object of the same type, T4 in this case, the
method in the base class is hidden. If you call through a base class
reference, T1 in this case, the "_apply" method in the subclass is hidden.
I'm guessing it's the same as overridi
On Thursday, 12 September 2013 at 11:29:22 UTC, Jacob Carlborg
wrote:
On 2013-09-12 11:28, Namespace wrote:
But if I try to write 'override' before [1], I get this error
message:
Error: function T4._apply cannot override a non-virtual
function
This seems inconsistent. I really overwrite the
On Thursday, 12 September 2013 at 16:16:14 UTC, Maxim Fomin wrote:
On Thursday, 12 September 2013 at 11:29:22 UTC, Jacob Carlborg
wrote:
On 2013-09-12 11:28, Namespace wrote:
But if I try to write 'override' before [1], I get this error
message:
Error: function T4._apply cannot override a non-