View Single Post
  #3  
AChimp AChimp is offline
Resident Chimp
AChimp's Avatar
Join Date: Nov 2000
Location: The Jungles of Borneo
AChimp is probably a real personAChimp is probably a real person
Old Apr 26th, 2004, 02:25 PM       
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;
}
Reply With Quote