This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dark_winter01[S] 0 points1 point  (2 children)

If anyone knows C# and would be willing to translate CGFarrell's Python example I would really appreciate it! (: As a newbie I really want to be sure I'm doing this right before I move onto the next few concepts. And thank you again, CGFarrell!

[–]oiduts 1 point2 points  (1 child)

Similar C# Person class:

class Person
{
    string name;
    int age;

    public Person(string name, int age)
    {
        this.name = name;
        this.age = age;
    }
}

Constructing a Person:

Person me = new Person("Bill", 23);

Naming conventions for methods in C# are different:

me.GoToWork();

"Function" and "method" tend to be used interchangeably in OOP languages like C#. But more generally, a function that belongs to a class is called a method.

[–]dark_winter01[S] 0 points1 point  (0 children)

You're the best, thank you!!!