struct Book { // Property public string Author { get; set; } public string Title { get; set; } private int copyright; public int Copyright { set { if (value < 2000) Console.WriteLine("\n this copyright is not valid"); else this.copyright = value; } get { return this.copyright; } } // Constructors public Book(string a, string t, int c) { Author = a; // Error happened! Title = t; Copyright = c; } }
public string Author { get; set; }
private int _Author ; public int Author { get { return _Author ; } set { _Author = value; } }
copyright
public Book(string a, string t, int c) { copyright = c; Author = a; Title = t; Copyright = c; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)