Re: what static fuction mean in c#
- From: "Guido Stercken-Sorrenti [MVP VC++]" <mspbn@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 15 Oct 2005 13:42:52 +0200
> when i was usong c++ idont have to put static before tha function that i
> want
> to acces but in c# i have to but it .
Well, in both languages you have to declare a member function as static if
you want to call that function without an instance of the class - it's the
same in both languages. In C++, like in C#, you need an instance to call a
nonstatic member function. I don't see why you think this would be
different?
--
Guido Stercken-Sorrenti
MVP - Visual Developer / Visual C++
"SemSem" <SemSem@xxxxxxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag
news:15C1C5E6-B944-493E-94C4-0AA9A18752B6@xxxxxxxxxxxxxxxx
> ihave a function called add(int x,int y)
> i have to put
> static int add(int x,int y) in prototype
> or i have this
> "an object refrence is required for the nonstatic field, methiod or
> property"
>
> i hope someone to tell me why as i think the idea of static in c# is not
> like in c++
> or tell me where to post this
>
> thanx at all
>
>
>
.
- Follow-Ups:
- Re: what static fuction mean in c#
- From: Bill Butler
- Re: what static fuction mean in c#
- Prev by Date: Re: I want to create a database and store and retrieve information
- Next by Date: Google Side Bar - Object reference not set to an instance of an object.
- Previous by thread: Re: SQL updates on MS Access Database: error: Operation must use an updateable query.
- Next by thread: Re: what static fuction mean in c#
- Index(es):
Relevant Pages
|