C#: Object Oriented Programming - Methods and Members [17 of 19]

Play C#: Object Oriented Programming - Methods and Members [17 of 19]

The Discussion

  • User profile image
    marcaroccooo
    loving horse ride in wet area
  • User profile image
    Karim

    Learning OOP in the time of Coronna.

  • User profile image
    KandiesB
    Pardon the bad analogy but this language is like a screwdriver: it's as powerful as you need it to be, love it.
  • User profile image
    Cordy

    Love the way you guys teach. Most I understand but then Scott is typing before explaining and then it goes fast and sometimes too fast for me. Doesn't matter. I just started out. When I start coding my own apps I will learn more.

  • User profile image
    Nicolas8888

    Isn't it strange that the accountNumberSeed is defined as static but we are incrementing it each time we instantiate a new BankAccount ?

  • User profile image
    kjm2002

    Dec 11, 2020 at 8:02AM

    Isn't it strange that the accountNumberSeed is defined as static but we are incrementing it each time we instantiate a new BankAccount ?



    I was curious about this at first glance myself as well.

    Would this be considered static still because of not manipulating the 'accountNumberSeed' directly, and only using it to create the 'number' variable?
  • User profile image
    LifeCup

    For anyone confused on static, it basically makes the variable or method available to the class as a whole. No object needs to be instantiated to use a static
    variable/method and all the objects of the class have access to that variable too.

    Incrementing a static variable changes it for the whole class, and any objects of that class.

    The static keyword does not mean unchanging, to create an unchanging variable we need to use the keyword 'const' (constant). A constant cannot be changed after it has been initialized.

Add Your 2 Cents