//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}"); }
static void Main(string[] args) { //interface Test1 t = new Test1(); t.show(); int val = t.addSum(10, 20); Console.WriteLine("the value of z is :- " + val); //abstract classes template obj; obj = new sampleOne(); obj.templateOne(); obj = new sampleTwo(); obj.templateOne(); int vol = obj.nonabstract(5); Console.WriteLine("the volume is : " + vol); //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); //static constructor Example.print(); //try-catch-finally var num1 = 5; var num2 = 0; Fabb n = new Fabb(); try { var num3 = num1 / num2; n.showTemp(); } catch (ArithmeticException e) { Console.WriteLine("this is an arthmetic divide by zero exception "); Console.WriteLine(e); } catch (TempIsZeroException e1) { Console.WriteLine("temperature is zero : {0}", e1.Message); } finally { Console.WriteLine("i have successfully reached finally block"); } //making of pointers MyClass m = new MyClass(); m.method(); Console.ReadKey(); }