Skip to main content

Posts

C# OOPs Concepts

Encapsulation : Encapsulation is a process of binding the data members and member functions into a single unit. Example for encapsulation is class . A class can contain data structures and methods. Consider the following class public class Aperture { public Aperture () { } protected double height; protected double width; protected double thickness; public double get volume() { Double volume=height * width * thickness; if (volume return 0; return volume; } } In this example we encapsulate some data such as height, width, thickness and method Get Volume. Other methods or objects can interact with this object through methods that have public access modifier Abstraction: Abstraction is a process of hiding the implementation details and displaying the essential features. Example1 : A Laptop consists of many things such as processor, motherboard, RAM, keyboard, LCD screen, wireless antenna, web camera, usb ports, batt...

SQL -Server - In case of multiple transaction in a procedure, what will happen if error will occur after inner transaction commit statement?

Committing inner transactions is ignored by the SQL Server Database Engine. The transaction is either committed or rolled back based on the action taken at the end of the outermost transaction. If the outer transaction is committed, the inner nested transactions are also committed. If the outer transaction is rolled back, then all inner transactions are also rolled back, regardless of whether or not the inner transactions were individually committed.

Dotnet Interview Question

1. What is Property? A property is a member that provides a flexible mechanism to read, write, or compute the value of a private field. Properties can be used as if they are public data members, but they are actually special methods called accessors . This enables data to be accessed easily and still helps promote the safety and flexibility of methods. Example: class TimePeriod { private   double seconds; public   double Hours { get { return seconds / 3600; } set { seconds = value * 3600; } } }   2. What is the difference between abstraction and encapsulation? Abstraction: Abstraction lets you focus on what the object does instead of how it does it That means we use the object without knowing the source code of the class. Encapsulation: Encapsulation means hiding the internal details or mechanics of how an object does something. Encapsulation is warping data into single unit. 3. What is the difference between c...