I have a confusion if any methods are declared in class extension are static or not

75 Views Asked by At
class Test: UIViewController{

    func abc() {
        print("This is ABC")
    }
}

extension Test {
    func def(){
        print("This is DEF")
     }
}

My question here is that

  1. what is the difference between both the methods declared?
  2. Is method def a static method?
  3. extending class to use protocols effects memory management?
1

There are 1 best solutions below

0
On

what is the difference between both the methods declared?

None, except two things

  1. one prints ABC and another DEF, they have different names
  2. you won't be able to override the method from the extension

Is method def a static method?

Nope, for this, you should say static

extending class to use protocols effects memory management?

Nope