Method hiding is also known as shadowing. The method of the parent class is available to the child class without using the override keyword in shadowing. The child class has its own version of the same function.Use the new keyword to perform shadowing.Let us see an example.Example Live Demousing System; using System.Collections.Generic; class Demo { public class Parent { public string GetInfo () { return "This is Parent Class!"; } } public class Child : Parent { public new string GetInfo() { ... Read More
It can be created with the help of the following query −mysql> Delimiter // mysql> CREATE PROCEDURE fact(IN x INT) -> BEGIN -> DECLARE result INT; -> DECLARE i INT; -> SET result = 1; -> SET i = 1; -> WHILE i SET result = result * i; -> SET i = i + 1; -> END WHILE; -> SELECT x AS Number, result as Factorial; -> END// Query OK, 0 rows affected (0.17 sec)Now when invoking this ... Read More
A number is an Armstrong number if the sum of the cube of each digit of the number is equal to the number itself.Here, we will find out the remainder and will sum it to the cube of remainder.rem = i % 10; sum = sum + rem*rem*rem;Then if the above sum that comes out after loop iteration is equal to the sum, then it will be an Armstrong number.if (sum == num) { Console.Write("Armstrong Number!"); }The following is an example −Exampleint num, rem, sum = 0; // checking for armstrong number num = 153; for (int i ... Read More
To create a bordered list without bullets, you can try to run the following code. The list-style-type is set to none to remove bullets to a listExampleLive Demo ul { background-color: orange; padding: 10px 20px; list-style-type: none; border: 2px solid black; } Countries India US Australia Output
The linking of a function with an object during compile time is called static binding. C# provides two techniques to implement static polymorphism: Function overloading and Operator overloading.In Function Overloading, you can have multiple definitions for the same function name in the same scope.Examplevoid print(int i) { Console.WriteLine("Printing int: {0}", i ); } void print(double f) { Console.WriteLine("Printing float: {0}" , f); }Overloaded operators are functions with special names. The keyword operator IS followed by the symbol for the operator being defineD.Examplepublic static Box operator+ (Box b, Box c) { Box box = new Box(); ... Read More
We can create MySQL stored procedures without ‘BEGIN’ and ‘END’ just in the same way created with both of them only thing is to omit to BEGIN and END. In the following example, we are creating a stored procedure without ‘BEGIN’ and ‘END’ to get all the rows from a table −Examplemysql> Delimiter // mysql> CREATE PROCEDURE Hello() -> SELECT * from Student_info; // Query OK, 0 rows affected (0.08 sec)We can see MySQL created stored procedures without BEGIN and END. Now invoke this by CALL statement −mysql> Delimiter ; mysql> CALL Hello(); +-----+---------+------------+------------+ | id | ... Read More
Mutable stringStringBuilder is a mutable string in C#. With StringBuilder, you can expand the number of characters in the string. The string cannot be changed once it is created, but StringBuilder can be expanded. It does not create a new object in the memory.Set StringBuilder −StringBuilder str = new StringBuilder();Let us see an example to learn how to work with StringBuilder in C# −Example Live Demousing System; using System.Text; public class Program { public static void Main() { StringBuilder str = new StringBuilder("Web World!!", 30); str.Replace("World", "Arena"); Console.WriteLine(str); ... Read More
Interfaces define properties, methods, and events, which are the members of the interface. Interfaces contain only the declaration of the members. It is the responsibility of the deriving class to define the members.Abstract classes to some extent serve the same purpose, however, they are mostly used when only a few methods are to be declared by the base class and the deriving class implements the functionalities.The following are the differences −A class may inherit more than one interface, whereas a class may inherit only one abstract class.Multiple Inheritance cannot be achieved using Abstract whereas with Interface we can achieve it.You ... Read More
A thread is defined as the execution path of a program. Each thread defines a unique flow of control.The following are the properties of the Thread class −Sr.No.Property & Description1CurrentContextGets the current context in which the thread is executing.2CurrentCultureGets or sets the culture for the current thread.3CurrentPrincipleGets or sets the thread's current principal (for role-based security).4currentThreadGets the currently running thread.5CurrentUICultureGets or sets the current culture used by the Resource Manager to look up culture-specific resources at run-time.6ExecutionContextGets an ExecutionContext object that contains information about the various contexts of the current thread.7IsAliveGets a value indicating the execution status of the current ... Read More
We can access one or all the tables from the MySQL stored procedure. Following is an example in which we created a stored procedure that will accept the name of the table as a parameter and after invoking it, will produce the result set with all the details from the table.Examplemysql> Delimiter // mysql> Create procedure access(tablename varchar(30)) -> BEGIN -> SET @X := CONCAT('Select * from', ' ', tablename); -> Prepare statement from @X; -> Execute statement; -> END// Query OK, 0 rows affected (0.16 sec)Now invoke the procedure with the table name, we ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP