Remote Methods and Inheritance

You can call remote actions on your Apex controller that are inherited methods. When a @RemoteAction method is looked up or called, Visualforce inspects the page controller’s inheritance hierarchy and finds @RemoteAction methods in the controller’s ancestor classes.
Here’s an example demonstrating this capability. The following Apex classes form a three-tier inheritance hierarchy:
1global with sharing class ChildRemoteController 
2    extends ParentRemoteController { }
3global virtual with sharing class ParentRemoteController 
4    extends GrandparentRemoteController { }
5
6global virtual with sharing class GrandparentRemoteController {
7    @RemoteAction
8    global static String sayHello(String helloTo) {
9        return 'Hello ' + helloTo + ' from the Grandparent.';
10    }
11}
This Visualforce page simply calls the sayHello remote action.
1<apex:page controller="ChildRemoteController" >
2    <script type="text/javascript">
3        function sayHello(helloTo) {
4            ChildRemoteController.sayHello(helloTo, function(result, event){
5                if(event.status) {
6                    document.getElementById("result").innerHTML = result;
7                }
8            });
9        }
10    </script>
11
12    <button onclick="sayHello('Jude');">Say Hello</button><br/>
13    <div id="result">[Results]</div>
14    
15</apex:page>
The remote method doesn’t exist in the ChildRemoteController class. Instead, it’s inherited from GrandparentRemoteController.