I learnt that deleting a global method is not allowed and even deprecating it leads to a lot of problems. But can I modify it in any way ? E.g. Suppose I have a global method and I have a requirement to slightly change its signature to include one more parameter -
global virtual override void printFullName (String firstName, String lastName) {
System.debug(firstName + lastName);
}
Q1 - Can I change its signature to include one more parameter like ?
global virtual override void printFullName (String firstName, String middleName, String lastName) {
System.debug(firstName + middleName + lastName);
}
Q2 - If that's not allowed, can I add another overloaded method and modify the body of the first method to call the overloaded method ?
global virtual override void printFullName (String firstName, String lastName) {
printFullName2(firstName, "", lastName);
}
global virtual override void printFullName2 (String firstName, String middleName, String lastName) {
System.debug(firstName + middleName + lastName);
}