Ejemplo n.º 1
0
int main()
{
    Bank* bank = new Bank();
    Account* acc = new Account(1);
    bank->Withdraw(acc, 100);

    Account* saving = new SavingAccount(2);
    bank->Withdraw(saving, 100);
    //As LSP states, the program should be able to use the objects of derived class without breaking any behavior of base class. So in this code, I am passing a SavingAccount instance to Withdraw method, which executes the function defined in Account class. So we are adhering to LSP pattern here.
}
Ejemplo n.º 2
0
int main()
{
	Bank bank;
	int choice;

	while(1)
	{
		system("cls");
		PrintMenu();
		cout << "선택 : ";
		cin >> choice;

		switch( choice)
		{
		case MAKE:		bank.MakeAccount();		break;
		case DEPOSIT:	bank.Deposit();			break;
		case WITHDRAW:	bank.Withdraw();			break;
		case INQUIRE:	bank.Inquire();			break;
		case EXIT:		return 0;
		default:
			cout << "잘못된 메뉴 입력 " << endl;
			break;
		}
		system("pause");
	}
	return 0;
}