account.cpp

来自「DCOM论文」· C++ 代码 · 共 58 行

CPP
58
字号
// Account.cpp : Implementation of CAccount
#include "stdafx.h"
#include "Bank.h"
#include "Account.h"
#include <stdio.h>
char  buffer[200];


/////////////////////////////////////////////////////////////////////////////
// CAccount



STDMETHODIMP CAccount::Deposit(double x)
{
	// TODO: Add your implementation code here
	
	sprintf(buffer,"%f",x);
	MessageBox(NULL,buffer,"提示",MB_OK);
	CurrentValue = CurrentValue+x;
	return S_OK;
}

STDMETHODIMP CAccount::Withdraw(double x)
{
	// TODO: Add your implementation code here
	CurrentValue = CurrentValue - x;
	return S_OK;
}

STDMETHODIMP CAccount::get_CurrentAccount(double *pVal)
{
	// TODO: Add your implementation code here
	*pVal = CurrentValue;
	return S_OK;
}

STDMETHODIMP CAccount::put_CurrentAccount(double newVal)
{
	// TODO: Add your implementation code here
	CurrentValue = newVal;
	return S_OK;
}

HRESULT CAccount::QueryInterface(REFIID riid,void** ppv)
{
	if(riid==IID_IUnknown)
		*ppv = (IUnknown*)this;
	else if(riid==IID_IAccount)
		*ppv = (IAccount*)this;
	else
	{
		*ppv = NULL;
		return E_NOINTERFACE;
	}
	return S_OK;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?