An abstract function cannot have functionality. You're basically saying, any child class MUST give their own version of this method, however it's too general to even try to implement in the parent class.
A virtual function, is basically saying look, here's the functionality that may or may not be good enough for the child class. So if it is good enough, use this method, if not, then override me, and provide your own functionality.
Why is it necessary for an interface to be "declared" abstract?
It's not.
public abstract interface Interface {
\___.__/
|
'----> Neither this...
public void interfacing();
public abstract boolean interfacing(boolean really);
\___.__/
|
'----> nor this, are necessary.
}
Interfaces and their methods are implicitly abstract
and adding that modifier makes no difference.
Is there other rules that applies with an abstract interface?
No, same rules apply. The method must be implemented by any (concrete) implementing class.
If abstract is obsolete, why is it included in Java? Is there a history for abstract interface?
Interesting question. I dug up the first edition of JLS, and even there it says "This modifier is obsolete and should not be used in new Java programs".
Okay, digging even further... After hitting numerous broken links, I managed to find a copy of the original Oak 0.2 Specification (or "manual"). Quite interesting read I must say, and only 38 pages in total! :-)
Under Section 5, Interfaces, it provides the following example:
public interface Storing {
void freezeDry(Stream s) = 0;
void reconstitute(Stream s) = 0;
}
And in the margin it says
In the future, the " =0" part of declaring methods in interfaces may go away.
Assuming =0
got replaced by the abstract
keyword, I suspect that abstract
was at some point mandatory for interface methods!
Related article: Java: Abstract interfaces and abstract interface methods
Best Answer
I believe you have to tell it which kind of JclCompressArchive to create, such as give it
arch := TJcl7zCompressArchive.Create...
instead of JclCompressArchive.Create().If you look at the "Class Hierarchy" section of JclCompression.pas:
Update
I think the proper way to use StackOverflow would have been to add a new question, since after the update, it's a completely different question.
I don't know why you're casting to TJclCompressArchive to AddFile() and Compress(), it seems to work for me without the casts