Jumat, 31 Maret 2017

How to refer super class members in C++ using super keyword

Second use of super keyword (in sub class) is to access the hidden members of its immediate super class. To understand this let’s consider the following example: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 class A { int x; public void display() { System.out.println(“This is display in A”); } } class B extends A { int x; public void display() { System.out.println(“Value of x in A is: “ + super.x); super.display(); System.out.println(“This is display in B”); } } class Driver {

The post How to refer super class members in C++ using super keyword appeared first on Coding Security.


How to refer super class members in C++ using super keyword
read more

What are inline member functions in C++

Making a function inline avoids the overhead of a function call. By default functions defined inside a class are inline. To get the benefits of making a function inline, functions defined outside the class can also be made inline. Syntax for defining a function as inline is as follows: 1 2 3 4 inline return–type ClassName :: function–name(params–list) { //Body of function } Consider the following example which demonstrates inline member functions: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

The post What are inline member functions in C++ appeared first on Coding Security.


What are inline member functions in C++
read more

What are hidden form fields in session tracking

Another way of passing data from one page to another page is by using a hidden form field. The advantage with this method is data is not visible to the user directly. But, when the user looks at the source of the web page in a browser, the data being passed will be visible. Following example demonstrates hidden form fields:   index.html 1 2 3 4 5 6 7 8 9 10 11 12 13 14 <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://ift.tt/2ewFFOU; <html> <head> <meta http-equiv=“Content-Type” content=“text/html; charset=ISO-8859-1”> <title>Hidden Fields</title> </head> <body> <form action=“ServletA” method=“post”> <input type=“hidden” value=“admin”

The post What are hidden form fields in session tracking appeared first on Coding Security.


What are hidden form fields in session tracking
read more

Kamis, 30 Maret 2017

What are the cases where method overriding is possible in Programming

Method overriding is possible only when the following things are satisfied: A class inherits from another class (inheritance). Both super class and sub class should contain a method with same signature. Note: Method overriding does not depend up on the return type of the method and the access specifiers like (public, private, protected etc..). What is the difference between method overloading and method overriding? Both may look similar but they are quite different in the following ways: Method overloading takes place when a class contains multiple methods with the same name but varying number of parameters or types of parameters.

The post What are the cases where method overriding is possible in Programming appeared first on Coding Security.


What are the cases where method overriding is possible in Programming
read more

An introduction to Exception Handling in Programming

In this article we will look at what is an exception?, what is exception handling?, and how Java supports exception handling.   In general, the errors in programs can be categorized into three types: Syntax errors: Also called compile time errors when a program violates the rules of the programming language. Ex: missing a semi colon, typing a spelling mistake in keyword etc. Run-time errors: Errors which are raised during execution of the program due to violation of semantic rules or other abnormal behaviour. Ex: dividing a number with zero, stack overflow, illegal type conversion, accessing an unavailable array element etc. Logic

The post An introduction to Exception Handling in Programming appeared first on Coding Security.


An introduction to Exception Handling in Programming
read more

What are Macro Substitution Directives in Programming

Macro substitution is a process where an identifier in a program is replaced by a predefined string composed of one or more tokens. The preprocessor accomplishes this task under the direction of #define statement. This statement, usually known as a macro definition takes the following form: If this statement is included in the program at the beginning, then the preprocessor replaces every occurrence of the identifier in the source code by the string. Note: Care should be taken that there is no space between the # and the word define. Also there should be atleast a single space between #defineand

The post What are Macro Substitution Directives in Programming appeared first on Coding Security.


What are Macro Substitution Directives in Programming
read more

Rabu, 29 Maret 2017

What is abstract class in C++ Programming

A class which contains at least one pure virtual function is called an abstract class. Since abstract class is incomplete, another class should derive it and provide definitions for the pure virtual functions in the abstract class.   Following are the features of an abstract class: Abstract class must contain at least one pure virtual function. Objects cannot be created for an abstract class. But pointers can be created. Classes inheriting an abstract class must provide definitions for all pure virtual functions in the abstract class. Otherwise, the sub class also becomes an abstract class. An abstract class can have

The post What is abstract class in C++ Programming appeared first on Coding Security.


What is abstract class in C++ Programming
read more