for fun in d: ifnot fun.startswith('__'): result = getattr(A(), fun)() print(result, end='')
Numpy
1 2 3
import numpy as np a = np.array([[1, 2], [3, 4]]) print(int(np.linalg.det(a)))
C++
Size
How many bits in a C++ byte?
4 / 8 / 8+ / depends on system
Flush
Which of the following will flush the output buffer?
std::cout << "Please flush!" << '\n';
std::cout << "Please flush!" << std::endl;
std::cout << "Please flush!" << std::flush;
printf("Please flush!");
Pointer
1 2 3
int arr[3] = {1, 2, 3}; int *p = arr; std::cout << *p++ << " " << * p << std::endl;
Virtual
The member function to call is resolved at compile time based on the type of the pointer or reference to the object.
The member function to call is resolved at runtime time based on the type of the pointer or reference to the the object.
The member function to call is resolved at runtime time based on the type of object (not the pointer or reference to the object), by checking the v-table realted to the object instance.
The member function to call is resolved at runtime time based on the type of object (not the pointer or reference to the object), by checking the v-table associated with the object class.