Errors, bugs, questions - page 1678
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
You can use this to make an analogue of the keyword final, explicitly prohibiting further inheritance.
But as the example above shows, you can't make an analogue. You must specify final even for private methods.
Strange. For public inheritance, the maximum access should be protected, not private.
And the function in the example is being overloaded exactly?
Strange. For public inheritance, the maximum access should be protected, not private.
And in the example, is the function exactly overloaded?
Right. I just found it out myself.
If you do in the example
BASE() {Func();} // вместо void Init() {Func();} Вызов Base.Init() - убрать конечно.
you can check yourself after you run it and see if you know what's supposed to happen.
In the terminal log I get
clumsily go to the specified location in the source code. It would be convenient if you could double-click on such a message in the terminal log and get straight to the specified line.
If anyone supports it, speak up.
The classic is an interface in a base class with redefinition in descendants:
Classic is when protected/public virtual methods are overridden. But for private, it's not so obvious (in terms of application). Thanks for replying.
Yes, I already deleted my example without seeing your reply, it was really unfortunate.
Upd. I got confused in the basics myself while I was answering you. Everything was correct in that example, I shouldn't have deleted it. The same example again with an example of use:
Upd. I got confused in the basics myself while I was answering you. Everything was correct in that example, I should not have deleted it. Again with an example of how to use it:
The compiler does not make a deuce.
This is not a good example, since we can't see the CAnimal interface being used anywhere. Also two descendants have been made public. I understand the topic, so it's ok.
Normal example. An abstract animal basically makes some sound, but undefined, so we cannot call the Speak() method on it; it can only be called on an animal of a specific species. Therefore we declare a closed virtual method in a base class, and override it in descendants and open it.
Normal example. An abstract animal basically makes some sound, but undefined, so we cannot call the Speak() method on it; it can only be called on an animal of a specific species. Therefore we declare a closed virtual method in a base class, and override it in descendants and open it.