Set - 6

Question 16 :

What's the difference between an interface and abstract class?

Answer :

In an interface class, all methods are abstract - there is no implementation. In an abstract class some methods can be concrete. In an interface class, no accessibility modifiers are allowed. An abstract class may have accessibility modifiers.


Question 17 :

What is the difference between a Struct and a Class?

Answer :

Struts are value-type variables and are thus saved on the stack, additional overhead but faster retrieval. Another difference is that struts cannot inherit.


Question 18 :

What's the implicit name of the parameter that gets passed into the set method/property of a class?

Answer :

Value. The data type of the value parameter is defined by whatever data type the property is declared as.


Question 19 :

What does the keyword "virtual" declare for a method or property?

Answer :

The method or property can be overridden.


Question 20 :

How is method overriding different from method overloading?

Answer :

When overriding a method, you change the behavior of the method for the derived class. Overloading a method simply involves having another method with the same name within the class.