protected void methodProtected()
protected access modifier means that this method can only be accessed from within the class itself or any derived class (a subclass) of the Person class.void, which means it doesn't return a value.info method (which is not defined in your provided code) with the message "Inside protected method. Inside Person Class."
protected void methodProtected(){
info("Inside protected method. Inside Person Class.");
}
protected void methodProtected(int a, int b)
a and b.Person class or any of its subclasses.void, indicating that it doesn't return a value.a and b that are passed as arguments.info method (which is not defined in your provided code) with the same message: "Inside protected method. Inside Person Class."
protected void methodProtected(int a, int b){
info("Inside protected method. Inside Person Class.");
}
public class Person
{
str firstname;
str lastname;
protected void methodProtected(){
info("Inside protected method. Inside Person Class.");
}
protected void addMethodProtected(int _a, int _b)
{
int c = _a + _b;
info(strFmt("Inside protected parameterized method1. Inside Person Class."));
info(strFmt(" --> %1 + %2 = %3", _a, _b, c));
}
protected int addMethodProtected1(int _a, int _b)
{
int c = _a + _b;
return c;
}
public static void main(Args _args){
setPrefix("Output");
Person person = new Person();
person.methodProtected();
person.addMethodProtected(12, 10);
int returnedValue;
returnedValue = person.addMethodProtected1(10, 11);
info(strFmt(" --> %1 ", returnedValue));
}
}
public static void main(Args _args): This is the entry point of the program, commonly found in X++ classes. The main method is where the program begins execution.
setPrefix("Output"): This function call seems to set a prefix for output. It's not defined in the provided code, but it could be a custom function responsible for configuring some aspect of the program.
Person person = new Person(): This line creates an instance of a class named Person and assigns it to the variable person. This assumes that you have a class named Person defined elsewhere in your code.
person.methodProtected(): It calls the methodProtected method of the person object. As indicated by the name, this method is protected, which means it's accessible only within the class Person and its subclasses.
person.addMethodProtected(12, 10): This line calls a method named addMethodProtected on the person object. Again, this method is not defined in the provided code, but it likely has a protected access modifier, considering the naming convention used.
int returnedValue;: Here, a variable named returnedValue of type integer is declared.
returnedValue = person.addMethodProtected1(10, 11);: This line calls a method named addMethodProtected1 on the person object with arguments 10 and 11. It appears to return an integer value, which is then assigned to the returnedValue variable.
info(strFmt(" --> %1 ", returnedValue));: This line uses the info function to display a message to the user. It formats the message as " --> " followed by the value of returnedValue.