PdfPrep.com

What is a correct example of calling the modifyCustTable method from NewClass2?

You create a new class named NewClass1 in a model. NewClass1 manipulates the CustTable table in the protected method modifyCustTable.

NewClass1 has the following code:

class NewClass1

{

public static MainClass1 construct()

{

return new MainClass1();

}

protected void modifyCustTable()

{



}

}

In the same model as NewClass1, you create a new class named NewClass2. You want to run the code in

the modifyCustTable method from the callModifyCustTable method in NewClass2.

What is a correct example of calling the modifyCustTable method from NewClass2?
A . {
public static NewClass2 construct()
{
return new NewClass2();
}
public void callModifyCustTable()
{
NewClass1 newClass1 = NewClass1::construct();
newClass1.modifyCustTable();
}
}
B . class NewClass2
{
public static NewClass2 contsruct()
{
return new NewClass2();
}
public void classModifyCustTable()
{
newClass1.modifyCustTable();
}
}
C . class NewClass2 extends NewClass1
{
public static NewClass2 contsruct()
{
return new NewClass2();
}
public void callModifyCustTable()
{
this construct().modifyCustTable();
}
}
D . class NewClass2 extends NewClass1
{
public static NewClass2 construct()
{
return new NewClass2();
}
public void callModifyCustTable()
{
this.modifyCustTable();
}
}

Answer: D

Exit mobile version