Answered

In Technology

Actually, overloading and polymorphism are two different things. Overloading is when two different functions of the same name but of different parameter types co-exist. The …compiler determines which to call by looking at the match between parameter types. An example might be a sin function taking a parameter of type float versus an overloaded version taking a parameter of type long double. In the first case, only a few terms of the taylor's series is needed for reasonable precision; in the second case, you need more than that. Polymorphism, on the other hand, is when the class type of the function is known only by virtue of a pointer to a class of that class, typically a pointer that is declared to hold a pointer to the base class but, at run-time, assigned to hold a pointer to one or the other of two derived child classes. An example might be an area function that computes the area of a shape, that might be derived to be a circle, a square, an ellipse, etc. (MORE)

Answered Most Recently

In Technology

Virtual Function A virtual function is a class method that is intended to be overridden by derived classes. This is achieved be preceding the function declaration with the key…word 'virtual'. If you fail to do this, derived classes can still override the method, but they will effectively hide the base class method. Moreover, when dealing with references or pointers to the base class of a derived class, calling the method will execute the base class method, not the override. By declaring the method virtual, you ensure expected behaviour. The derived class can still call the base class method explicitly, if required, but the base class will always call the override without the need to include runtime code to determine the actual type of the derived class. The virtual-table (or vtable) takes care of all that for you and costs very little in terms of memory and speed compared to using runtime information. In fact, the use of runtime information to access derived class behaviour is a clear indication of poor class design. As a side-note, a pure-virtual function is one that is declared to be virtual but that MUST be overridden by derived classes. You achieve this by appending '=0' to the function declaration, before the semi-colon. When you do this, you are signifying that your class is intended to act as a common interface to all its derived classes, which will themselves provide the specific implementations of those methods. You also signify that your class is abstract; you cannot instantiate an abstract class other than by derivation. Derived classes that do not fully implement all the pure-virtual methods inherited from their base classes become abstract themselves. However, derived classes can inherit implementations defined in higher base classes, other than the base class that originally declared the method pure-virtual. Typically, abstract classes have none or few member variables, and little if any implementation; they are conceptual classes rather than concrete classes. By way of an example, circles and squares are types of shape. You cannot draw a shape without knowing its type, but since all shapes can be drawn, all shapes have a common interface: Draw(). Thus the Shape class can be declared abstract with a pure-virtual Draw() method. All classes derived from Shape (such as Circle and Square) must therefore implement the Draw() method. You can then create collections of shapes without regard to their actual type; calling the Draw() method will invoke the appropriate override. While this behaviour is really no different to the way in which a standard virtual function works, the difference is that you cannot instantiate a Shape class (other than by derivation) and the Shape class need not provide any implementation. Any implementation that is provided by the abstract class must be called explicitly, just as it would if it were declared virtual rather than pure-virtual. Friend Function A friend function is any function that is external to a class (including methods of other classes) that is declared to be a friend of the class. Entire classes can also be declared friends of other classes, if required. This is achieved by including the function prototype (exactly as it appears in the function's declaration) within the class declaration, preceded by the keyword 'friend'. Friend classes can be declared in their entirety by preceding the class name with the keywords 'friend class' in the class declaration. Friends of a class are treated as extensions to the class interface and have the same access rights as the class itself. That is; unrestricted access to the private members of the class. As such they are highly privileged and should be used with a measure of caution. If misused, they can potentially undermine the encapsulation of your class. As a general rule, if the class interface is such that the public interface is sufficient for the external function to achieve its purpose, there is absolutely no need to declare the function a friend of the class. But if the function requires access to private and/or protected members of the class and exposing those members to public access would itself undermine the encapsulation of the class, then a friend function is the simplest solution. Unfortunately, there is no way to expose individual members of a class to a friend function -- it's all or nothing. However, friends are not subject to inheritance. That is, if Tom is derived from Dick and Harry is Dick's friend, Tom is not a friend of Harry unless Harry is specifically declared a friend of Tom. Friend classes are often declared when two classes work closely together as a single unit. In such cases, one class may be more dominant than the other, but private access may still be required in both directions. Therefore the dominant class must be declared a friend of the other class (allowing the dominant class complete access to the other class) while specific methods of the other class can be declared friends of the dominant class, allowing only those specific methods access to the dominant class. This is the only way to achieve bi-directional access to private members. You cannot declare specific friend functions in both as the classes will not compile. At least one class must be late-bound to the other by declaring it a friend (in its entirety) of the other. However, in some cases it may be better to simply declare external functions to be friends of both instead. In this way, the classes can be treated separately and can be fully encapsulated, while the external functions can be used to treat them as a single unit wherever required. Ultimately, friends should be used as minimally as possible in order to minimise coupling and dependency. With a well-designed interface, friends should rarely, if ever, be required, but the option is there for those cases where there is no other solution. (MORE)

Updated Answer

In Shopping

the function of a pencil is to write with out getting your hands dirty and to be able to write on paper instead of stone.

Updated Answer

1. An action performed by a device, department, or person that produces a result. Function remains more or less fixed whereas the purpose (which indicates intention or objecti…ve) generally changes. For example, the function of a hammer is to strike something nearby whereas its purpose (what to strike and why) could be anything the hammer-wielder has in mind. 2. Mathematics: A mathematical relationship in which a quantity (dependent variable) depends on or is determined by another quantity (independent variable) or quantities. The dependent variable is said to be a function of the independent variable(s). If something is done, or something happens, to the independent variable(s), it is reflected in the dependent variable. See link below (MORE)

Answered

In Uncategorized

Functions of diplomacy or diplomatic mission are FOLLOWING: 1. Reporting 2. Negotiation REPORTING: Reporting involves the observation of political, economic, social and mil…itary condition of the host state. INGRATIATION: Negotiation is the second substantive function of diplomatic mission. It involves for the greatest part. The transmission of message between the foreign minister of the sending state and the host state (receiving state). (MORE)

Answered

In Technology

function prototype is declaration of function without its body and ends with a semicolon. The return type, parameter type and their order are specified. Where as function sig…nature does not give you return type for overloading. This is not the concept in c by the way. Methods in Object oriented languages have method signatures. Hope this answers your question! (MORE)

Answered

In Calculus

The signum function is defined as follows: f(x) = -1 if x < 0 = 0 if x=0 = 1 if x > 0 It is not one-to-one (bijective) as can be easility seen). f(2)=1 f(3)=1 f(…10)=1 and so on. (MORE)

Answered

A recursive function does have an element of repetition. However, it should never repeat its actions verbatim - or this would create an infinite recursion. A recursive fun…ction has one or more base cases - where the function simply returns a value. A recursive function also has one or more recursive cases - where the function calls itself with a different ("smaller") input, and may combine the results of these calls. Please see the related links for further discussion. (MORE)

Answered

In Microbiology

To provide energy for a certain, specialized function. In the case of a car engine, to convert chemical energy, in the form of Fuel, such as Gasoline or Diesel, in to Mechanic…al energy, the force of the moving parts. (MORE)

Answered

In Grammar

The theory of grammar that is concerned with how the pragmatic, cognitive, and social functions of language relate to structure is functional grammar. It is the general th…eory that was developed by Simon C. Dik about the organization of natural language. (MORE)

In File Types

Excel is an incredibly versatile program. It can be used to achieve very simple ends, such as recording your income each month; or it can be used for complex databases and dat…a analysis. Data that is entered into a spreadsheet can be processed and manipulated in many types of ways, thanks to Excel's extensive selection of functions. SIGN is one of Excel's simpler functions. It returns the sign of any whole number provided as an argument.Excel allows data to be processed in many ways thanks to a large selection of function types. Some functions are used regularly, such as SUM, which simply sums all the values in an array. Other functions have very specific applications, and are more likely to be used by developers. SIGN, despite being a very simple function to use, falls into the latter category. Returning the sign of a number will mainly be of use in complex mathematical processes."Sign" is a mathematical concept. All non-zero numbers have a sign. A number greater than zero is positive. A number less than zero is negative. Zero is signless. A number's sign is often denoted through the use of the plus symbol for positive numbers (+) and the minus symbol for negative numbers (-).SIGN is one of Excel's most basic functions. It is used to return the sign of a number. It accepts a single whole number as an argument. It will output one of three responses, based on the argument provided. If the argument evaluates to zero, then the function returns "0." If the argument evaluates to a negative value, the function returns "-1." If the argument evaluates to a positive value, the function returns "1."To insert the SIGN function into an open workbook file (spreadsheet), click on any cell to make it active. Type the function as: =SIGN([number]). The equals sign at the start of the function is important, as it lets Excel know that you have entered a function rather than a text string. The value of "number" is the argument you are evaluating. This could be a hard-coded number, or it could be a cell reference. It is also possible to use the SIGN function as an argument for other functions.As a simple example, imagine you have the value 50 in cell A1. To evaluate the sign of that value, you would use the formula: =SIGN(A1). The result would be "1," as the value is positive. If you want to, you can also use SIGN as part of more complex formulas. For example, if you want to convert the numerical output of SIGN into words, you could use a formula such as: =IF(SIGN(A1)=1,"positive","zero or less"). In this example, if the value of A1 is positive, the function will display the word "positive," otherwise it will display "zero or less."Excel has an incredibly diverse range of functions. Some of them are very useful in many situations, and you will find yourself using them often. Other functions have much narrower applications, and you may never need them at all. The SIGN function is very simple to use, as it accepts a single whole number as an argument, and then returns the sign of that number."Sign" is a mathematical concept. All non-zero numbers have a sign. A number greater than zero is positive. A number less than zero is negative. (MORE)

In Functions

Microsoft Excel spreadsheets are easy to use because of the many built-in functions. One such useful feature is the ceiling function. You can use it to round up numerical valu…es as desired. Its most common application is in dealing with prices, where nickels and pennies are rounded off to dimes.The ceiling function is used to round off a numerical value with or without a decimal part. You can specify the closest multiple to which the rounding off must be done. This is always done on the higher side by default. There are a maximum of three variables within this Excel function. Of these, only the first variable is mandatory.To apply the ceiling function to a particular cell in an Excel spreadsheet, type "= CEILING (number, significance)." The first variable inside the brackets is the numerical value that needs rounding off. The function's second variable is its significance; the number will be rounded off to the nearest multiple of this value. You can assign integer or decimal values to the significance variable. If no value is specified, a default value of 1 is used to round up the number to the nearest integer.Just like positive numbers, negative numbers are generally rounded off on the upper side, which is closer to zero. For example, -3.4 would be rounded off as -3. You can change this by assigning a value of 1 to a third variable, called mode. With this, the resultant value after rounding off will be -4. Note that the mode does not apply to positive numbers.You may not always remember the syntax of the ceiling function. The easier option is to choose it from the drop down menus provided in Excel. You need to choose "Math & Trig" from the menu, and then select "ceiling" from the list. The required function will open up in a dialog box. Here, you can replace its variables with the appropriate values. Once you have applied this function to a particular cell, it can be extended across that row or column by dragging the cell from its bottom-right corner.CEILING (43.63, 0.10) is an example showing how this function works. Its result will be 43.7 even though 43.63 is numerically closer to 43.6. Adding the mode variable as 1 to this function will not change its result. In the case of negative numbers, CEILING (-43.63, 0.10) will give you -43.6. Here, you can change the direction of rounding off by adding the mode. So, CEILING (-43.63, 0.10, 1) gives -43.7.Microsoft Excel's functions help you to work with numerical values in many ways. Trailing decimal places can get tedious, especially when their length varies between numbers. The ceiling function is very useful in rounding off these values to a fixed number of decimal places or to the nearest integer. You can then sum up the rounded numbers or use them in other formulae.Microsoft Excel's functions help you to work with numerical values in many ways. Trailing decimal places can get tedious, especially when their length varies between numbers. The ceiling function is very useful in rounding off these values to a fixed number of decimal places or to the nearest integer. (MORE)