Code:
#include<iostream>
#include<string>
#include "User.h"
using namespace std;
#define VALID 1
#define GOOBER 0
typedef class User User;
typedef class SmartUser SmartUser;
int checkUserType( User * newUser )
{
int flag = VALID;
SmartUser check = dynamic_cast< SmartUser >( newUser );
if( !check )
{
flag = GOOBER;
delete( check );
}
return flag;
}
int main( int argc, char * argv[] )
{
string name = argv[1];
User *myUser = NULL;
if( strcmp( "Telltolin", name ) == 0 )
{
myUser = getUserObj( name );
if( checkUserType( myUser ) == GOOBER )
{
cerr<< "Too dumb to continue. :(\n"<< endl;
exit( EXIT_FAILURE );
}
}
cout<< "You are OKAY. :picklehat\n"<< endl;
return EXIT_SUCCESS;
}
