-1

Can I call a method in another class with the same method name but with different cases. For example a method testMethod() is in classA. And itsl is called as ClassA.TestMethod() in ClassB. Will it work?

2
  • 1
    Welcome to SFSE! Please take the tour and read How to Ask. You will need to edit your question to include more details. Commented Apr 22 at 13:07
  • In the same class? no. In another class? almost certainly yes. This is assuming you're working entirely within Apex (no JS/Aura/LWC). Please edit your question to include an example of what you're trying to do. If you're running into any errors, you should copy/paste the entirety of the error verbatim.
    – Derek F
    Commented Apr 22 at 13:07

1 Answer 1

1

Yes, it's possible to call a method in another class with the same method name but different cases. For instance, if you have a method named testMethod() in ClassA, and you call it as ClassA.TestMethod() from ClassB (as long as testMethod() is public), the code should work as expected. However, your IDE might show a warning for case mismatch. But in terms of functionality, it should work fine.

1
  • 1
    If the IDE knows about Apex (e.g. VS Code), it should be able to resolve the symbols correctly anyways.
    – sfdcfox
    Commented Apr 22 at 14:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .