Recent questions tagged object-oriented-concept

Description : What is Interface?

Last Answer : An Interface is a group of constants and method declaration interface like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation

Description : How many types of Access Modifiers?

Last Answer : Public – Allows the members to be globally accessible. Private – Limits the member’s access to only the containing type. Protected – Limits the member’s access to the containing type and all classes derived from the containing type. Internal – Limits the member’s access to within the current project

Description : Whait is Method overriding?

Last Answer : Method overriding occurs when child class declares a method that has the same type arguments as a method declared by one of its superclass. By declaring base class function as virtual, we allow the function to be overridden in any of derived class

Description : What is a Method Overloading?

Last Answer : Method with same name but with different arguments is called method overloading

Description : What is Polymorphism?

Last Answer : Polymorphism means same operation may behave differently on different classes. Example : 1. Method Overloading and Method Overriding

Description : Is .NET C# supports Multiple inheritance?

Last Answer : Multiple inheritance of classes is not allowed in C#. but In C# you can implements more than one interface, thus multiple inheritance is achieved through interface

Description : Can you allow a class to be inherited, but prevent the method from being overridden?

Last Answer : Yes. Just leave the class public and make the method sealed

Description : Can you prevent your class from being inherited by another class?

Last Answer : Yes. The keyword “sealed” will prevent the class from being inherited.

Description : What are Sealed Classes in C#?

Last Answer : The sealed modifier is used to prevent derivation from a class

Description : What is an Inheritance?

Last Answer : The process of sub-classing a class to extend its functionality is called Inheritance. Advantage : It provides idea of reusability.

Description : What is ref keyword & out keyword?

Last Answer : Refrence Variable “must” be initialized before it is passed into a method.

Description : What is Value Type and Reference Type?

Last Answer : A variable is value type or reference type is solely determined by its data type. Ex: int, float, char, decimal, bool, decimal, struct, etc are value types As name suggest Reference Type stores reference to the ... ; Y = X; Console.writeline(Y.value); Y.value = 50; Console.writeline(X.value);

Description : What is Enumeration?

Last Answer : Enumeration improves code readability. It also helps in avoiding typing mistake

Description : What is a Garbage collection?

Last Answer : Garbage collection is the mechanism that reclaims the memory resources of an object when it is no longer referenced by a variable. And Net Runtime performs automatically performs garbage collection

Description : What is the difference between the destructor and the Finalize() method? When does the Finalize() method get called?

Last Answer : Finalize() corresponds to the .Net Framework and is part of the System.Object class. Destructors are C#'s implementation of the Finalize() method. The functionality of both Finalize() and the destructor is the same

Description : What is Destructor?

Last Answer : A destructor is just opposite to constructor. it has same as the class name, but with prefix ~ (tilde). They do not have return types

Description : What is Finalize() Method of Object class?

Last Answer : Each class in C# is automatically (implicitly) inherited from the Object class which contains a method Finalize(). This method is guaranteed to be called when your object is garbage collected

Description : What is Static Constructor?

Last Answer : In C# it is possible to write a static no-parameter constructor for a class. Such a class is executed once, when first object of class is created. Class MyClass { static MyClass() { //Initialization Code for static fields and properties. } }

Description : What is Static Method of the class?

Last Answer : Methods that you can call directly without first creating an instance of a class. 1. As static methods may be called without any reference to object

Description : What is static member of a calss?

Last Answer : Static members belong to the whole class rather than to individual object Static members are accessed with the name of class rather than reference to objects

Description : What is Constructor?

Last Answer : A constructor is a special method whose task is to initialize the object of its class. 1. It is special because its name is the same as the class name 2. They do not have return ... can call the base class constructor 4. Constructor is invoked whenever an object of its associated class is created

Description : Whar are properties?

Last Answer : Attribute of object is called properties Example:- A car has color as property.

Description : What is an encapsulation?

Last Answer : Wrapping up of data and function into a single unit is known as Encapsulation.

Description : What is an Object?

Last Answer : Instance of Class is called object. An object is created in memory using keyword “new”.

Description : What is a Class?

Last Answer : A user-defined data structure that groups properties and methods. Class doesn’t occupies memory.

To see more, click for the full list of questions or popular tags.