Reputation: 15
I am declaring functions in interface but as soon as i add a new function in already completed module it gives me an error. The module which was working properly stops working.
interface iBoqCart{
public function add_toCart($item_id,$cqty,$user_id,$uniqid);
public function all_cartDatas($user_id);
public function delCart($cart_id);//delete cart
public function dellAllCart($user_id);
public function allCart();
public function new_function(); // this is my new function if i remove it my previous module in application starts working.
}
As i am new in OOP i am not display proper error, i am displaying error from client side.
Upvotes: 0
Views: 57
Reputation: 268
First of all, you need to develop an understanding of OOP before implementing it because you are going to trip over every single hurdle along the way otherwise which makes for an incredibly unpleasant experience.
Classes that implement interfaces MUST declare the functions in that interface, if any class misses any of the declared functions, it will throw an Exception.
Upvotes: 1