Convert a PHP object to an associative array

Just typecast it From Arrays: If an object is converted to an array, the result is an array whose elements are the object’s properties. The keys are the member variable names, with a few notable exceptions: integer properties are unaccessible; private variables have the class name prepended to the variable name; protected variables have a ‘*’ … Read more

Multiple Inheritance in C#

Since multiple inheritance is bad (it makes the source more complicated) C# does not provide such a pattern directly. But sometimes it would be helpful to have this ability. C# and the .net CLR have not implemented MI because they have not concluded how it would inter-operate between C#, VB.net and the other languages yet, … Read more

What is char ** in C?

Possible Duplicate:What is double star? I am fairly new to C, and have come across this statement I have a pretty good idea of what typedef does, but I have never seen char** before. I know that char* is a char array or similiar to a string. Im not sure if char** is a 2d … Read more

Categories C Tags

What does question mark and dot operator ?. mean in C# 6.0?

It’s the null conditional operator. It basically means: “Evaluate the first operand; if that’s null, stop, with a result of null. Otherwise, evaluate the second operand (as a member access of the first operand).” In your example, the point is that if a is null, then a?.PropertyOfA will evaluate to null rather than throwing an exception – it will then compare that null reference with foo (using string’s == overload), … Read more

Using the fstream getline() function inside a class

the function for streams that deals with std::string is not a member function of istream but rather a free function it is used like so. (the member function version deals with char*). It is worth noting there are better safer ways to do what you are trying to do like so: don’t reinvent the wheel; … Read more

Implements vs extends: When to use? What’s the difference?

extends is for extending a class. implements is for implementing an interface The difference between an interface and a regular class is that in an interface you can not implement any of the declared methods. Only the class that “implements” the interface can implement the methods. The C++ equivalent of an interface would be an abstract class (not EXACTLY the same … Read more