---
schema_version: "1"
id: 625abf7bf56c0a707a750f5acadf520d4aa99d2d345bbd1034e12f234bc07c0a
title: Remote Methods and Inheritance
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-pages-developers-guide/guides/pages/javascript/pages-js-remoting-remote-method-inheritance.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-js-remoting-remote-method-inheritance.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5e443315af5efaa5df9962d90f0e26bffb252da7fade31d28235320a548a7e0a
products:
  - Visualforce Developer Guide
  - Platform Developer Content
---

# 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:

```apex
global with sharing class ChildRemoteController 
    extends ParentRemoteController { }
global virtual with sharing class ParentRemoteController 
    extends GrandparentRemoteController { }

global virtual with sharing class GrandparentRemoteController {
    @RemoteAction
    global static String sayHello(String helloTo) {
        return 'Hello ' + helloTo + ' from the Grandparent.';
    }
}
```

This Visualforce page simply calls the `sayHello` remote action.

<!-- otherprops: set_clipboard -->
```apex_page
<apex:page controller="ChildRemoteController" >
    <script type="text/javascript">
        function sayHello(helloTo) {
            ChildRemoteController.sayHello(helloTo, function(result, event){
                if(event.status) {
                    document.getElementById("result").innerHTML = result;
                }
            });
        }
    </script>

    <button onclick="sayHello('Jude');">Say Hello</button><br/>
    <div id="result">[Results]</div>
    
</apex:page>
```

The remote method doesn’t exist in the `ChildRemoteController` class. Instead, it’s inherited from `GrandparentRemoteController`.

