Home All Groups Group Topic Archive Search About

Static and non static functions

Author
5 Jun 2006 2:27 PM
Alejandro
Is it possible for a class to have a function available both as static
and as instance function?

Author
5 Jun 2006 4:13 PM
Carl Daniel [VC++ MVP]
"Alejandro" <alebro***@gmail.com> wrote in message
news:1149517677.979822.76950@i40g2000cwc.googlegroups.com...
> Is it possible for a class to have a function available both as static
> and as instance function?

Yes, but the parameter lists have to be different (just like any set of
overloaded functions).

-cd
Author
5 Jun 2006 7:00 PM
Saad Rehmani
Hello Alejandro,

Why do you want to have two different methods? Is there a difference in behavior
between them?

Saad


Show quote
> Is it possible for a class to have a function available both as static
> and as instance function?
>
Author
6 Jun 2006 8:13 AM
Vadym Stetsyak
Hello, Alejandro!

A> Is it possible for a class to have a function available both as static
A> and as instance function?

Compiler will not let you define twice or more methods with same name and same signature.
There will be compiler error...

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com

AddThis Social Bookmark Button