static void Main(string[] args) { //accessing private values........... Program one = new Program(); Console.WriteLine(one.name); Console.WriteLine(one.num); //accessing public values............ Programone o = new Programone(); Console.WriteLine(o.model); o.display(); o.display(5, 10); //static method...................... int m = Programone.test(20, 14); Console.WriteLine($"the value of m is {m}"); //making multiple objects and assigning values to it.... one.gender = "female"; one.rollno = 1217271; one.college = "jmit"; Console.WriteLine($"{one.gender} ,{one.rollno},{one.college}"); Program two = new Program(); two.gender = "male"; two.rollno = 1217281; two.college = "jmieti"; Console.WriteLine($"{two.gender} ,{two.rollno},{two.college}"); //parameterised constructor............................. Virtual v1 = new Virtual("heaven"); Console.WriteLine(v1.name1); Virtual v2 = new Virtual("maruti", "black", 2000); Console.WriteLine(v2.model + " " + v2.color + " " + v2.year); //default constructor.................................. Virtual v3 = new Virtual(); //copy constructor Virtual v4 = new Virtual("this is copy constructor", 300); Virtual v5 = new Virtual(v4); //abstract classes...................................... template obj; obj = new sampleOne(); obj.templateOne(); obj = new sampleTwo(); obj.templateOne(); obj.nonAbstract(); //.......................................................... //interfaces implementation................................. Myclass ob1 = new Myclass(); ob1.show(); int val = ob1.sum(20, 10); Console.WriteLine(val); //getter and setter method.................................. Student s = new Student(); s.Name = "Parneet Kaur Vig"; Console.WriteLine("Name is:" + s.Name); Console.ReadLine(); Console.ReadKey(); }
//copy constructor public Virtual(Virtual v4) { topic_name = v4.topic_name; article_no = v4.article_no; Console.WriteLine($"the topic name is- {topic_name} and the article number is {article_no}"); }