Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- Overloading



  PHP function overloading puzzle clearer

PHP's meaning of overloading is different than Java's. In PHP, overloading means that you are able to add object members at runtime, by implementing some of the __magic methods, like __get, __set, __call, __callStatic. You load objects with new members. Overloading in PHP provides means to dynamically "create" properties and methods. These dynamic entities are processed via magic methods one can establish in a class for various action types. Some example:class Foo{    p...

   PHP,function overloading,OOP,default val     2011-07-11 03:24:30

  Time to think about supporting max/min functions for integers in GoLang

Sometime back we wrote a post explaining why there is no max/min function support for integers in GoLang, one of the reasons is that no overloading is supported and the function name has been used for other numeric types float64. To solve this problem and make max/min function support integer as well, either GoLang should support overloading like in Java or the same set of functions need to be created in a different package other than standard math. These don't look like good options as overload...

   MIN,MAX,GENERICS,GOLANG     2021-07-24 03:14:42

  Polymorphism in OOP programming

Polymorphism is the capability of an action or method to do different things based on the object that it is acting upon. This is the third basic principle of object oriented programming. Overloading, overriding and dynamic method binding are three types of polymorphism. Overloaded methods are methods with the same name signature but either a different number of parameters or different types in the parameter list. For example 'spinning' a num...

   Java,OOP,Polymorphism,Overloading,Overri     2014-10-23 08:11:50

  How to teach "Modern" Perl?

Since I started my Perl Tutorial series a couple of people commented on what and how I am teaching.Some people asked why did I show "open or die" and why not using autodie. Others recommended the use IO::All instead of open.Another complaint was the introduction of time and localtime instead of DateTime.While I was mostly writing parts of my regular training material these comments led me to think about it again. I wonder how to teach Perl in 2012?When I started to write the tutorial I still cal...

   Perl,Trainning,Teach,Modern,Modern Perl     2011-11-15 08:40:18

  C++, Ruby and CoffeeScript complexity comparison

There are many programming languages around the world, they all designed to help programmer solve some problems, finish some tasks. These languages are often divided into different types, there are structural, object-oriented, functional, scripting languages etc. Some are easy to pick up such as Java, while some are thought to be difficult to learn such as C++. So how do we understand complexities of different programming languages?Many people agree that C++ is very complex languages, it has poi...

   Complexity, languages, C++,Ruby,CoffeeScript     2012-06-12 04:46:01

  Why using + to concatenate string in Java loop is not a good option

String concatenation is a common operation in Java programming. It is to concatenate multiple strings into a single string. Java provides a String class which is an immutable class which means the object cannot be mutated once instantiated. Once a String object is instantiated, its properties cannot be changed anymore, so when concatenating strings, it's actually create a new String instance to store the concatenated string values. For example, below is a simple string concatenation example. Str...

   JAVA,STRING,JAVA 8     2019-01-18 22:07:12

  Why would I learn C++11, having known C and C++?

I am a programmer in C and C++, although I don't stick to either language and write a mixture of the two. Sometimes having code in classes, possibly with operator overloading, or templates and the oh so great STL is obviously a better way. Sometimes use of a simple C function pointer is much much more readable and clear. So I find beauty and practicality in both languages. I don't want to get into the discussion of "If you mix them and compile with a C++ compiler, it's not a mix ...

   C++11,New feature,Study     2012-03-16 08:44:38

  C++ Versus Objective-C

What will programming in Objective-C mean to the C++ programmer Different Object Oriented Languages Almost all of us have heard the term object oriented programming, and most of us have used C++. How will Apple's purchase of NeXT, and NeXT's framework using Objective-C affect us as we develop software? If we know C++ already, how hard will it be to get up to speed on Objective-C? Many people will agree that once they understand the concepts of object oriented programming it doesn't matter...

   C++,Objective-C,OOP,Comparison,Methods,Philosohpy     2011-12-12 07:51:40

  C vs Java Complete Comparison

Similarities: Java and C have same syntax operators. Difference—thinking Two paradigms: Java: Object oriented language C: Structured language Differences: --Syntax No preprocessor Java does not include a preprocessor and does not define any analogs of the #define, #include, and #ifdef directives. Constant definitions are replaced with static final fields in Java. (See the java.lang.Math.PI field for an example.) Macro definitions are not available in...

   C,Java,Comparison,Difference,Similaritie     2011-10-06 12:46:39

  One good way to use optional parameter in function

In GoLang, it doesn't support method overloading like in Java, hence sometimes it would be a headache to create functions to construct new structs with different parameters.  Normally, we would construct the new function as below when want to let others create a new struct instance with explicit function call. type Queue struct { Name string } func NewQueue(name string) *Queue { return &Queue{name} } But with the scope and complexity of the struct increases, there might be more prope...

   OPTION PATTERN,VARIADIC FUNCTION,OPTIONAL PARAMETER     2020-09-18 21:45:29