Shawn
Shawn
CC#
Created by Frite on 6/26/2024 in #help
how can I avoid chaos like this ?
Why do you want properties?
18 replies
CC#
Created by kav on 6/26/2024 in #help
new to c#! not too sure why i can't call my method from class
- Your Addition method is taking two parameters, which happened to be named the same as your private fields, but are distinct values. Because you named the parameters the same, they're taking precedence over your private fields, causing confusion. If you want to add your two private fields together, you'd just do so, with no parameters for your Addition method. - If it is the case that you want to add the private fields together, you wouldn't call Class.Method() - that would be for a static method, not an instance method. Instead, you'd call instance.Method(), as in calc1.Addition() in this case
9 replies