Static Class Attributes
Lesson 29Author : 🦒
Last Updated : November, 2017
Code
public class Song{
public string title;
public string artist;
public static int songCount = 0;
public Song(string title, string artist){
this.title = title;
this.artist = artist;
songCount++;
}
}
public class App
{
public static void Main(string[] args)
{
Song song1 = new Song("Holiday", "Green Day");
Console.WriteLine(Song.songCount)
}
}