Archive for the ‘C/C++’ Category

C/C++ – symbols in object files

August 22, 2006

In order to check if a certain symbol (e.g., function) is defined in a certain object file you can use:

nm object_file | grep symbol_name

Advertisements

C++ – funtion template

August 18, 2006

Here is an example of a function template:

template <class T>
T Add(T a, T b)
{
return a+b;
}

C++ – output operator

August 17, 2006

In order to enable the output operator << in your object you need to add the following function in your class definition:

friend ostream& operator<<(ostream& out, const ClassName& object)
{

return out;
}