¤¤¤ FAQ’s ¤¤¤
Are private class-level variables inherited?
Yes, but they are not accessible. Although they are not visible or accessible via the class interface, they are inherited.
– What’s the top .NET class that everything is derived from?
– the term immutable mean?
The data value may not be changed. Note: The variable value may be changed, but the original immutable data value was discarded and a new data value was created in memory
– the advantage of using System.Text.StringBuilder over System.String?
StringBuilder is more efficient in cases where there is a large amount of string manipulation. Strings are immutable, so each time a string is changed, a new instance in memory is created.
– Can you store multiple data types in System.Array?
– What’s the implicit name of the parameter that gets passed into the set method/property of a class?
value. The data type of the value parameter is defined by whatever data type the property is declared as.
– What is the role of the DataReader class in ADO.NET connections?
It returns a read-only, forward-only rowset from the data source. A DataReader provides fast access when a forward-only sequential read is needed
What is a satellite assembly?
When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.
———————- That’s all for now
One of the troubling question faced by my past students is differences between abstract class and interfaces here is the final solution as doc file
lets continue with other questions
- Explain about Protected and protected internal, “internal” access-specifier?
protected – Access is limited to the containing class or types derived from the containing class.
internal – Access is limited to the current assembly.
protected internal – Access is limited to the current assembly or types derived from the containing class.
- Difference between type constructor and instance constructor? What is static constructor, when it will be fired? And what is its use?
(Class constructor method is also known as type constructor or type initializer)
Instance constructor is executed when a new instance of type is created and the class constructor is executed after the type is loaded and before any one of the type members is accessed. (It will get executed only 1st time, when we call any static methods/fields in the same class.) Class constructors are used for static field initialization. Only one class constructor per type is permitted, and it cannot use the vararg (variable argument) calling convention.
A static constructor is used to initialize a class. It is called automatically to initialize the class before the first instance is created or any static members are referenced.
- What is Private Constructor? and it’s use? Can you create instance of a class which has Private Constructor?
A: When a class declares only private instance constructors, it is not possible for classes outside the program to derive from the class or to directly create instances of it. (Except Nested classes)
Make a constructor private if:
– You want it to be available only to the class itself. For example, you might have a special constructor used only in the implementation of your class’ Clone method.
– You do not want instances of your component to be created. For example, you may have a class containing nothing but Shared utility functions, and no instance data. Creating instances of the class would waste memory.
- I have 3 overloaded constructors in my class. In order to avoid making instance of the class do I need to make all constructors to private?
- Overloaded constructor will call default constructor internally?