CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2008
    Posts
    4

    how to call a funtion...

    hello,

    i have a problem with c#, i´m new with these... Well, the problem is that i have a project with all my .cs and a library.dll that it is allready in the Debug folder. i have to run a function in learning.cs from my.cs, the code is this:

    learning.cs

    namespace PDL
    {
    public class C
    {
    .... code ....

    public bool learn()
    {
    //the interest code//
    }
    }

    In my.cs how can i call the function "public bool learn()" to start the code?


    Thank u for ur time!

  2. #2
    Join Date
    Mar 2004
    Location
    Prague, Czech Republic, EU
    Posts
    1,701

    Re: how to call a funtion...

    First, you need to have entry point (Main() method), second, you need a instance of the class C:
    Code:
    C c = new C();
    bool r = c.learn();
    • Make it run.
    • Make it right.
    • Make it fast.

    Don't hesitate to rate my post.

  3. #3
    Join Date
    Jan 2007
    Posts
    491

    Re: how to call a funtion...

    Or, you can make the 'learn' method static, and do the following:
    Code:
    bool b = C.learn();

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured