adplus-dvertising
frame-decoration

Question

Correct way to define object of sample class in which code will work correctly is:
class abc
 {
     int i;
     float k;
     public abc(int ii, float kk)
     {  
         i = ii;
         k = kk;
     }
 }

a.

abc s1 = new abc(1);

b.

abc s1 = new abc();

c.

abc s2 = new abc(1.4f);

d.

abc s2 = new abc(1, 1.4f);

Posted under C# programming

Answer: (d).abc s2 = new abc(1, 1.4f);

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Correct way to define object of sample class in which code will work correctly is:

Similar Questions

Discover Related MCQs

Q. Correct statement about constructors in C#.NET is ?

Q. Which among the following is the correct statement :
Constructors are used to

Q. Can the method add() be overloaded in the following ways in C#?

public int add() { }
public float add(){ }

Q. Which of the following statements is correct about constructors in C#.NET?

Q. What is the return type of constructors?

Q. Which method has the same name as that of its class?

Q. Which operator among the following signifies the destructor operator?

Q. The method called by clients of a class to explicitly release any resources like network,connection,open files etc.When the object is no longer required?

Q. Name a method which has the same name as that of class and which is used to destroy objects also called automatically when application is finally on process of being getting terminated.

Q. Operator used to free the memory when memory is allocated ?

Q. Select wrong statement about destructor in C#?

Q. What is the return type of destructor ?

Q. Which among these access specifiers should be used for main() method?

Q. Which of these is used as default for a member of a class if no access specifier is used for it?

Q. What is the process by which we can control what parts of a program can access the members of a class?

Q. Which of these base class are accessible to the derived class members?

Q. Which of these access specifiers must be used for class so that it can be inherited by another sub class?

Q. Which of the following statements are incorrect ?

Q. Accessibility modifiers defined in a class are?