C# Tutorial For Beginners 2024 - 11. Class Github repo for project: github.com/teddysmithdev/CSha... Twitter: / teddysmithdev Github: github.com/teddysmithdev Linkedin: / teddy-smith-015ba61a3
Пікірлер: 3
@untalentedwebdev2 ай бұрын
After building using function components with react for so long, I've completely forgot how classes work so I'm here to relearn haha. I like how you also show whats actually happening with the compilers too.
@TeddySmithDev2 ай бұрын
React components confusing af compared to classes.
@kvelezАй бұрын
var animal = new Animal("Rex", "Dog", 5); animal.PrintAnimal(); animal.animalAge = 10; animal.PrintAnimal(); Console.WriteLine(animal.animalName); animal.animalType = ""; animal.PrintAnimal(); public class Animal { public string animalName { get; set; } public string animalType { get; set; } public int animalAge { get; set; } public Animal(string name, string type, int age) { animalName = name; animalType = type; animalAge = age; } public void PrintAnimal() { Console.WriteLine("Name: " + animalName); Console.WriteLine("Type: " + animalType); Console.WriteLine("Age: " + animalAge); } }