cast object with a Type variable

newObjectType is an instance of the Type class (containing metadata about the type) not the type itself. This should work var newObject = givenObject as MyClass; OR var newObject = (MyClass) givenObject; Casting to an instance of a type really does not make sense since compile time has to know what the variable type should … Read more

No function matches the given name and argument types

Your function has a couple of smallint parameters. But in the call, you are using numeric literals that are presumed to be type integer. A string literal or string constant (‘123’) is not typed immediately. It remains type “unknown” until assigned or cast explicitly. However, a numeric literal or numeric constant is typed immediately. The … Read more

Returning function pointer type

int (*getFunc())(int, int) { … } That provides the declaration you requested. Additionally, as ola1olsson notes, it would be good to insert void: int (*getFunc(void))(int, int) { … } This says that getFunc may not take any parameters, which can help avoid errors such as somebody inadvertently writing getFunc(x, y) instead of getFunc()(x, y).