nerdexam
Microsoft

MB6-704 · Question #50

You have a class named Classl thatcontains a static method namedsmethodl and an instance method named method2. Classl contains the following X+ + code: (Line numbers are included for reference…

The correct answer is B. Classl::smethodl (). Calling a Static Method In the following example, there is no need to first construct an instance of the SoftwareKey class before you call a static method on the class. To call the static method validateSoftwareKey, the syntax starts with the name of the class that contains the…

Develop X++ code

Question

You have a class named Classl thatcontains a static method namedsmethodl and an instance method named method2. Classl contains the following X+ + code: (Line numbers are included for reference only.) You need to callsmethodl from method2. Which code segment should you insert at line 10?

Options

  • ACloss l.smethodl()
  • BClassl::smethodl ()
  • CThis::smethodl()
  • DThis.smthodl()

How the community answered

(32 responses)
  • A
    6% (2)
  • B
    72% (23)
  • C
    19% (6)
  • D
    3% (1)

Explanation

Calling a Static Method In the following example, there is no need to first construct an instance of the SoftwareKey class before you call a static method on the class. To call the static method validateSoftwareKey, the syntax starts with the name of the class that contains the method. A pair of colon (::) characters is used to connect the class name to the static method name. boolean yourBool = SoftwareKey::validateSoftwareKey (yourSoftwareKeyString);

Topics

#static methods#X++ syntax#method invocation#scope resolution

Community Discussion

No community discussion yet for this question.

Full MB6-704 Practice