C# - Programming Language
This course covers the basics of programming in C#. Work your way through the videos/articles and I'll teach you everything you need to know to start your programming journey!

Constructor Function

Lesson 26
Author : GOUP
Last Updated : September, 2020


Code

Copypublic class Book{
     public String title;
     public String author;

     public Book(String title, String author){
          this.title = title;
          this.author = author;
     }
}

public class App
{
     public static void Main(string[] args)
     {
          Book book1 = new Book("Harry Potter", "JK Rowling");
          Console.WriteLine(book1.title);

          Book book2 = new Book("Lord of the Rings", "JRR Tolkien");
          Console.WriteLine(book2.title);
     }
}