Static Binding vs Dynamic Binding in C#

Arjun Thakur
Updated on 20-Jun-2020 14:49:26

3K+ Views

Polymorphism can be static or dynamic. In static polymorphism, the response to a function is determined at the compile time. In dynamic polymorphism, it is decided at run-time.Compile Time Polymorphism or Static BindingThe mechanism of linking a function with an object during compile time is called early binding. It is also called static binding or early binding.Run Time Polymorphism or Dynamic BindingRuntime polymorphism has method overriding that is also known as dynamic binding or late binding.Abstract classes contain abstract methods, which are implemented by the derived class. The derived classes have more specialized functionality. Dynamic polymorphism is implemented by abstract classes and virtual functions.Read More

Static Class in C#

Samual Sam
Updated on 20-Jun-2020 14:49:07

874 Views

The C# static class cannot be instantiated and can only have only static members. The static class in C# is sealed and cannot contain instance constructors.The following is an example with static class and static members −Example Live Demousing System; public static class Demo {    public static float PI = 3.14f;    public static int calc(int n){return n*n;} } class Program {    public static void Main(string[] args) {       Console.WriteLine("PI: "+Demo.PI);       Console.WriteLine("Square: " + Demo.calc(3));    } }OutputPI: 3.14 Square: 9Above, the static class is −public static class Demo {   ... Read More

Transform Element Along X-Axis Using CSS

George John
Updated on 20-Jun-2020 14:47:05

316 Views

Use the translateX(n) method to transform the element along with x-axis.Let us see the syntaxtranslateX(n)Here, n is a length representing the abscissa of the translating vector.Let us see an examplediv {    width: 50px;    height: 50px;    background-color: black; } .trans {    transform: translateX(20px);    background-color: orange; }

CSS3 Multi-Column Rule Style Property

Priya Pallavi
Updated on 20-Jun-2020 14:45:47

70 Views

The multi-column rule-style property is used to specify the style rule for the column. You can try to run the following code to implement rule-style property using CSS −ExampleLive Demo                    .multi {             /* Column count property */             -webkit-column-count: 4;             -moz-column-count: 4;             column-count: 4;                         /* Column gap property */             ... Read More

What are Pointer Data Types in C#

karthikeya Boyini
Updated on 20-Jun-2020 14:45:09

2K+ Views

A pointer is a variable whose value is the address of another variable i.e., the direct address of the memory location. Similar to any variable or constant, you must declare a pointer before you can use it to store any variable address.The syntax of a pointer is −type *var-name;The following is how you can declare a pointer type −int *ip; /* pointer to an integer */ double *dp; /* pointer to a double */C# allows using pointer variables in a function of code block when it is marked by the unsafe modifier. The unsafe code or the unmanaged code is ... Read More

Static Keyword in C#

George John
Updated on 20-Jun-2020 14:44:40

3K+ Views

We can define class members as static using the static keyword. When we declare a member of a class as static, it means no matter how many objects of the class are created, there is only one copy of the static member.The keyword static implies that only one instance of the member exists for a class. Static variables are used for defining constants because their values can be retrieved by invoking the class without creating an instance of it.The following is an example showing the usage of static variables −Example Live Demousing System; namespace StaticVarApplication {    class StaticVar { ... Read More

Transform Element Along X-Axis and Y-Axis with CSS

Chandu yadav
Updated on 20-Jun-2020 14:44:07

2K+ Views

Use the translate(x,y) method to transform the element along with x-axis and y-axis.Let us see the syntaxtranslate(x,y)Here, x is a length representing the x-coordinate of the translating vector.y is a length representing the ordinate of the translating vectorLet us see an examplediv {    width: 50px;    height: 50px;    background-color: orange; } .trans {    transform: translate(20px);    background-color: black; }

Threads in C#

Samual Sam
Updated on 20-Jun-2020 14:43:40

711 Views

A thread is defined as the execution path of a program. Each thread defines a unique flow of control. If your application involves complicated and time-consuming operations, then it is often helpful to set different execution paths or threads, with each thread performing a particular job.The life cycle of a thread starts when an object of the System.Threading.Thread class is created and ends when the thread is terminated or completes execution.The following are the various states in the life cycle of a thread −The Unstarted State - It is the situation when the instance of the thread is created but ... Read More

Ternary Operator in C#

karthikeya Boyini
Updated on 20-Jun-2020 14:43:03

3K+ Views

Ternary operator is a Conditional operator in C#. It takes three arguments and evaluates a Boolean expression.For example −b = (a == 1) ? 20 : 30;Above, if the first operand evaluates to true (1), the second operand is evaluated. If the first operand evaluates to false (0), the third operand is evaluated.The following is an example −Example Live Demousing System; namespace DEMO {    class Program {       static void Main(string[] args) {          int a, b;          a = 10;          b = (a == 1) ? 20 : 30;          Console.WriteLine("Value of b is {0}", b);          b = (a == 10) ? 20 : 30;          Console.WriteLine("Value of b is {0}", b);          Console.ReadLine();       }    } }OutputValue of b is 30 Value of b is 20

Write Single Line Comments in C#

Samual Sam
Updated on 20-Jun-2020 14:42:22

333 Views

If you want to add a comment that restricts itself to a single line, then use the single-line comments −// variable int i = 20;The following is a sample C# program showing how to add single-line comments −Example Live Demousing System; namespace Demo {    class Program {       static void Main(string[] args) {          // display text          Console.WriteLine("Hello World");          Console.ReadKey();       }    } }OutputHello World

Advertisements