Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Error
//Rextester.Program.Main is the entry point for your code. Don't change it. //Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354) using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Monster { //public data members public string name_; public int size_; public const legs_ = 2; } //private data members private int scare_; //static data members private int nMonsters_; //default constractor public Monster() { name_ = "default"; size_ = 10; scare_ = 20; nMonsters_++; } public Monster(string name, int size, int scare) { name_ = name; size_ = size; scare_ = scare; nMonsters++; } //methods public void print() { Console.WriteLine("Monsters name: " + name_); Console.WriteLine("Monsters size: " + size_); Console.WriteLine("Momsters scare: " + scare_); } public class Program { public static void Main(string[] args) { Monster Dinosour = new Monster(); Console.WriteLine(Dinosour.name_); Dinosour.name_ = "Rex"; Console.WriteLine(Dinosour.name_); //using non-defauld-constractor Monster Dragon = new Monster("Drako", 30, 25); Console.WriteLine(Monster.nMonsters_); Monster Zombie = new Monster("Zombie", 6, 8); Zombie.print(); Dragon.print(); Dinosour.print(); Console.WriteLine(Monster.nMonsters_); } } }
run
|
edit
|
history
|
help
0
base exterior
Wild West of Meming
List_methods
Math 5.8
free robux
Group by Example
C# Truly Random
Pet Name Generator
JagArray
Reflection 2