how to call a function of another class

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
hi i am currently trying to call a function of another class.
(i am not trying to copy the function over i am trying to calling directly to it)
something like:
class main
{
cow cow1= new cow();
dog dog1 = new dog();
}
i am trying to call for lets say a fucntion called moo from the dogs class fucntion within the dog class.
class dog
{
void woof()
{
moo();
}
}
if this was c++ i would have pass the mains instance variable over to both the cow and dog class upon creation but i have no idea how to do this in c# pls help

View the full article
 
Back
Top