Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to listen an abstract method?

In my abstract class can I listen an abstract method and fire an event whenever that method is called? If yes how?

like image 467
emregon Avatar asked Aug 19 '11 19:08

emregon


People also ask

How do you access the abstract method?

A method which does not have body is known as abstract method. It contains only method signature with a semi colon and, an abstract keyword before it. public abstract myMethod(); To use an abstract method, you need to inherit it by extending its class and provide implementation to it.

How abstract methods work?

An abstract method is a method that is declared, but contains no implementation. Abstract classes may not be instantiated, and require subclasses to provide implementations for the abstract methods.


1 Answers

Abstract or no, you're looking for an Inversion of Control (IoC) framework here, specifically one that lets you do method interception.

I'd look at Unity, or Spring. There are a few others out there.

like image 142
kprobst Avatar answered Oct 11 '22 06:10

kprobst