gs gs108 Object Oriented Concepts - Constructor Overloading - Quiz No.1
gs gs108 CSharp Quiz
This quiz belongs to book/course code gs gs108 CSharp of gs organization. We have 110 quizzes available related to the book/course CSharp. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Object Oriented Concepts. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
class maths { public maths() { Console.WriteLine("constructor 1 :"); } public maths(int x) { int p = 2; int u; u = p + x; Console.WriteLine("constructor 2: " +u); } } class Program { static void Main(string[] args) { maths k = new maths(4); maths t = new maths(); Console.ReadLine(); } }
constructor 1: constructor 2: 6
constructor 2: 6 constructor 2: 6
constructor 2: 6 constructor 1:
class maths { int i; public maths(int x) { i = x; Console.WriteLine(" hello: "); } } class maths1 : maths { public maths1(int x) :base(x) { Console.WriteLine("bye"); } } class Program { static void Main(string[] args) { maths1 k = new maths1(12); Console.ReadLine(); } }
class maths { int i; public maths(int ii) { ii = -25; int g; g = ii > 0 ? ii : ii * -1; Console.WriteLine(g); } } class maths1 :maths { public maths1(int ll) :base(ll) { ll = -1000; Console.WriteLine((ll > 0 ? ll : ll * -1)); } } class Program { static void Main(string[] args) { maths1 p = new maths1(6); Console.ReadLine(); } }
-25 -1000
-1000 -25
25 1000