ME FIRST GAMES
Menu
games for me and you
![]() In C#, everything is associated with classes and objects. A class is simply a "blueprint" for objects, defining their values and behaviors. ⭐️ Example 🚗 We define a class Car. It has a value for gas and the ability to move. 🚙 We can instantiate many Cars. Each car is an object with the type of class Car. ✅ Thus, any changes we make in the class Car will be reflected in all the car objects we create. ⭐️ Variables, properties, and methods comprise a class. 📌 Variables hold the state (values) for the class. 📌 Properties usually are just wrappers for variables, preventing us from setting them to an invalid state. 📌 Methods implement behaviors. Your class may have methods to Move, Honk, Stop, Turn, etc. ⭐️ Private vs Public 📌 These special keywords change the access level to certain variables, properties, and methods. 🕵️♀️ Private - The type or member can only be accessed by code in the same class (or struct). 💁♀️ Public - The type or member can be accessed by any other code. ✅ Use these keywords to create an interface for your Class. So the inner details are all handled inside and external code won't change variables or call methods that put your class into an invalid state. ⭐️ Here are some interesting features we'll look up in the future. I suggest your research them beforehand. 📌 Classes may inherit behavior and values from another class. e.g. Horse class inherits from Animal class. 📌 Classes can be defined as static. Meaning, the class is the one-and-only one instance of itself. 📌 Classes have more access levels: Protected, Internal, and Protected Internal. 📌 Classes are always allocated on the Heap.
0 Comments
Leave a Reply. |
Me First Games is an independent game studio dedicated to creating unique and bizarre video games.
Red MatterStar Impact is an upcoming adventure platformer coming to PC, Mac, and Linux.
Archives
April 2021
Categories |
Copyright (c) 2020 Me First LLC
|