Board index » delphi » virtual static function

virtual static function

Hello,
Is it possible to define a class member function as the Delphi analog to
C++'s "virtual static" function?
In C++ this is actually not possible, but in Java it is. Is it possible in
Delphi?

Thanks in advance.

 

Re:virtual static function


Quote
In article <3e3ea...@newsgroups.borland.com>, Dmitry wrote:
> Is it possible to define a class member function as the Delphi analog to
> C++'s "virtual static" function?
> In C++ this is actually not possible, but in Java it is. Is it possible in
> Delphi?

You can have class methods that are virtual and override them in descendent
classes. I suppose that is what you want.

--
Peter Below (TeamB)  
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be

Re:virtual static function


If you explain it in detail, maybe...
If you mean "virtual private", it's possible, but nonsense, since it can't
be overridden. The only private virtuals that can be overridden are fixed
indexed dynamic methods (like message handlers):
type
  TA = class
  private
    procedure A;virtual;
    procedure B; message 1;
 end;

  TB = class(TA)
  private
    procedure A;override; //<-error
    procedure whatever; message 1;// this overrides TA.B method, name does
not matter, index matters
 end;

--
Robert Cerny

Quote
"Dmitry" <di...@REMOVEscopus.net> wrote in message

news:3e3ead00@newsgroups.borland.com...
Quote
> Hello,
> Is it possible to define a class member function as the Delphi analog to
> C++'s "virtual static" function?
> In C++ this is actually not possible, but in Java it is. Is it possible in
> Delphi?

> Thanks in advance.

Re:virtual static function


Delphi has "Static" function, but it meaning of this word is different in
context of Delphi. Static means - method that cannot be overriden.   I
think, there is no such thing as "static" in C++ meaning.  I hardly imagine
how it could be virtual in C++ too :).  (Virtual function requires an
object, which allows to allocate correct function.)

Best regards,
Artur

Re:virtual static function


Quote
"Artur" <artu...@balticsolutions.com> wrote in message

news:3e43a07e$1@newsgroups.borland.com...
Quote
> Delphi has "Static" function, but it meaning of this word is different in
> context of Delphi. Static means - method that cannot be overriden.

Yes, but virtual means it *can* be overriden.

Quote
> I think, there is no such thing as "static" in C++ meaning.  I hardly
imagine
> how it could be virtual in C++ too :).

Huh? Any non-virtual method is static. Where did you get the idea that all
methods in C++ are virtual?

Still, you didn't explain what do you mean with self contradicting
contruction you call "virtual static function".

--
Robert Cerny

Other Threads