#includeusing namespace std; class MyObject { public: void print() { cout << "This is an object" << endl; } }; int main() { MyObject obj; if (isObject(obj)) { obj.print(); } else { cout << "This is not an object" << endl; } return 0; }
#includeDescription: This code declares an integer variable "num" and checks if it is an object using isObject. Since an integer is a primitive data type rather than an object, the output of this code will be "This is not an object". Package/Library: This code requires the "typeinfo" library which provides information about the type of objects at runtime.using namespace std; int main() { int num = 5; if (isObject(num)) { cout << "This is an object" << endl; } else { cout << "This is not an object" << endl; } return 0; }