Please help me to understand this:
Hi i was wondering if i could get some feed back on this code:
using System;
namespace Pratice
{
class Example
{
public void DoSomething()
{
Console.WriteLine("do something with this object");
}
}
class ExampleUser
{
public void UseExample(Example example)
{
Console.WriteLine("this is an example");
}
}
}
public void UseExample(Example example)
{
Console.WriteLine("this is an example");
}
what is it called when we pass another method into another one should i just say "this code is accepting the the class Example as a method reference" what? idk the termnoigly i was wondering if someone could explainthis to me
like whats going on in this example
1 Reply
you're passing a class, not a method
you can call it taking/accepting an argument
the
Example example
part itself is a parameter
for classes you would be passing a reference, but other types like structs and numbers are passed by value by default