Show DevBest [Mac]Simple PHP OOP Bank Class

Status
Not open for further replies.

Mac

New Member
Feb 9, 2011
111
2
PHP:
<?php
class BankAccount {
	public $accountname;
	public $accountnumber;
	public $accountmoneys;
	public function __construct($accname, $accnumber) {
		$this->accountname = $accname;
		$this->accountnumber = $accnumber;
	}
	public function __changeName($newaccname) {
		$this->accountname = $newaccname;
	}
	public function __changeNumber($newaccnumber) {
		$this->accountnumber = $newaccnumber;
	}
        public function __changeMoneys($newmoneyamount) {
                $this->accountmoneys = $newmoneyamount;
        }
	public function __giveMoneys($accmoneys) {
		$this->accountmoneys = $this->accountmoneys + $accmoneys;
	}
	public function __user_giveMoneys($accmoneys2) {
		$this->accountmoneys = $this->accountmoneys + $accmoneys2;
	}
	public function __takeMoneys($howmuch) {
		$this->accountmoneys = $this->accountmoneys - $howmuch;
	}
	public function __user_takeMoneys($howmuch2) {
		$this->accountmoneys = $this->accountmoneys - $howmuch2;
	}
	public function __getUserDetails() {
		echo "<p>Name: ".$this->accountname."</p>";
		echo "<p>Number: ".$this->accountnumber."</p>";
		if(!is_numeric($this->accountmoneys)):
			echo "<p>INVALID MONEYS!!!</p>";
		else:
			echo "<p>Moneys: ".$this->accountmoneys."</p>";
		endif;
	}
}

If you wanna post a improve , don't post it with words , just give new source.

Obv credits to me for making class!

Thanks!
 

Mac

New Member
Feb 9, 2011
111
2
This is a bank class ! If someone wants to make a bank script on oop , they can use this class.
 
Status
Not open for further replies.

Users who are viewing this thread

☀️  Switch to Light Theme

Latest posts

Top