What is Encapsulation in C#

Ankith Reddy
Updated on 20-Jun-2020 13:14:00

528 Views

Encapsulation in C# prevents access to implementation details. Implement Encapsulation in C# using access specifiers.The following are the access specifiers supported by C# −PublicPrivateProtectedInternalProtected internalEncapsulation can be understood by taking an example of private access specifier that allows a class to hide its member variables and member functions from other functions and objects.In the following example we have length and width as variables assigned private access specifier −Example Live Demousing System; namespace RectangleApplication {    class Rectangle {       private double length;       private double width;       public void Acceptdetails() {     ... Read More

MySQL LENGTH Function: Measure String Length

Sravani S
Updated on 20-Jun-2020 13:13:11

318 Views

MySQL LENGTH() function measures the string length in ‘bytes’ which means that it is not multibyte safe. The difference of the result between multi-byte safe functions, like CHAR_LENGTH() or CHARACTER_LENGTH(), and LENGTH() function especially relevant for Unicode, in which most of the characters are encoded in two bytes or relevant for UTF-8 where the number of bytes varies. For example, if a string contains four 2-bytes characters then LENGTH() function will return 8, whereas CHAR_LENGTH() or CHARACTER_LENGTH() function will return 4. It is demonstrated in the example below −Examplemysql> Select LENGTH('tutorialspoint'); +--------------------------+ | LENGTH('tutorialspoint') | +--------------------------+ |       ... Read More

Make jQuery Function Call After X Seconds

Kristi Castro
Updated on 20-Jun-2020 13:12:17

4K+ Views

To make a jQuery function call after “X” seconds, use the siteTimeout() method.On button click, set the following and fade out the element. Here, we have also set the milliseconds. This is the delay that would occur before fading an element:$("#button1").bind("click",function() {    setTimeout(function() {       $('#list').fadeOut();}, 4000); });You can try to run the following code to learn how to work with setTimeout() method in jQuery:Example Live Demo               $(document).ready(function(){          $("#button1").bind("click",function() {             setTimeout(function() {                $('#list').fadeOut();}, 4000);             });          });               India       US       UK     The above data will fade out after 4 seconds

Difference Between CEILING, FLOOR, and ROUND Functions in MySQL

Govinda Sai
Updated on 20-Jun-2020 13:12:04

7K+ Views

The CEILING() function returns the smallest integer value that is not smaller than X. Consider the following example –mysql> Select CEILING(3.46); +---------------+ | CEILING(3.46) | +---------------+ |             4 | +---------------+ 1 row in set (0.00 sec)   mysql> Select CEILING(-6.43); +----------------+ | CEILING(-6.43) | +----------------+ |             -6 | +----------------+ 1 row in set (0.02 sec)The FLOOR() function returns the largest integer value that is not greater than X. Consider the following example –mysql> Select FLOOR(-6.43); +--------------+ | FLOOR(-6.43) | +--------------+ |           -7 ... Read More

What are Nested Classes in C#

karthikeya Boyini
Updated on 20-Jun-2020 13:11:19

364 Views

A nested class is a class declared in another enclosing class. It is a member of its enclosing class and the members of an enclosing class have no access to members of a nested class.Let us see an example code snippet of nested classes in C# −class One {    public int num1;    public class Two {       public int num2;    } } class Demo {    static void Main() {       One a = new One();       a.num1++;       One.Two ab = new One.Two();     ... Read More

Significant Difference Between MySQL TRUNCATE and ROUND Function

Srinivas Gorla
Updated on 20-Jun-2020 13:11:16

5K+ Views

The TRUNCATE() function is used to return the value of X truncated to D number of decimal places. If D is 0, then the decimal point is removed. If D is negative, then D number of values in the integer part of the value is truncated. Consider the following example –mysql> Select TRUNCATE(7.536432, 2); +----------------------+ | TRUNCATE(7.536432, 2) | +----------------------+ |                 7.53 | +----------------------+ 1 row in set (0.00 sec)The ROUND() function returns X rounded to the nearest integer. If a second argument, D, is supplied, then the function returns X rounded ... Read More

What are Static Members of a Class in C++

Samual Sam
Updated on 20-Jun-2020 13:10:49

5K+ 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. Static variables can be initialized outside the member function or class definition. You can also initialize static variables inside the class ... Read More

Raise a Number to the Power of Another Number in MySQL

Govinda Sai
Updated on 20-Jun-2020 13:09:47

381 Views

POWER() function is used to raise a number to the power of another number. POW() is the synonym of POWER() function. In these functions, the first arguments work as the base and the second argument works as the exponent. SyntaxPOWER(M, N)  Here, M is the number which is the base of exponentiation. N is the number which is the exponent of exponentiation.Examplemysql> Select POWER(2,3),POW(2,3); +------------+----------+ | POWER(2,3) | POW(2,3) | +------------+----------+ |          8 |        8 | +------------+----------+ 1 row in set (0.00 sec)

What are Static Member Functions in C++

karthikeya Boyini
Updated on 20-Jun-2020 13:09:32

744 Views

Static functions can access only static variables. The static functions exist even before the object is created.Set static functions as −public static int getNum() {}The following is an example demonstrating the use of static functions −Example Live Demousing System; namespace Demo {    class StaticVar {       public static int num;       public void count() {          num++;       }       public static int getNum() {          return num;       }    }    class StaticTester {       static void Main(string[] args) {          StaticVar s = new StaticVar();          s.count();          s.count();          s.count();          Console.WriteLine("Variable num: {0}", StaticVar.getNum());          Console.ReadKey();       }    } }OutputVariable num: 3

Use MySQL POWER Function with Column Data Values

Samual Sam
Updated on 20-Jun-2020 13:09:17

164 Views

If we want to use POWER() function with column’s data values then the first argument i.e. the base would be the name of the column and the second argument i.e. the exponent would be as specified by us. To understand it considers a table ‘Employee’ having the following records −mysql> Select * from Employee; +----+--------+--------+ | ID | Name   | Salary | +----+--------+--------+ | 1  | Gaurav | 50000  | | 2  | Rahul  | 20000  | | 3  | Advik  | 25000  | | 4  | Aarav  | 65000  | | 5  | Ram    | 20000  | ... Read More

Advertisements