Linked Questions

2187 votes
42 answers
1.0m views

Can someone provide a simple explanation of methods vs. functions in OOP context?
willc2's user avatar
  • 39.8k
1280 votes
37 answers
631k views

I have heard that the Liskov Substitution Principle (LSP) is a fundamental principle of object oriented design. What is it and what are some examples of its use?
NotMyself's user avatar
  • 30.2k
1002 votes
18 answers
195k views

Could someone explain? I understand the basic concepts behind them but I often see them used interchangeably and I get confused. And now that we're here, how do they differ from a regular function?
sker's user avatar
  • 18.5k
491 votes
9 answers
202k views

The following code compiles in Swift 1.2: class myClass { static func myMethod1() { } class func myMethod2() { } static var myVar1 = "" } func doSomething() { myClass....
Senseful's user avatar
  • 92.6k
394 votes
16 answers
135k views

a can only be final here. Why? How can I reassign a in onClick() method without keeping it as private member? private void f(Button b, final int a){ b.addClickHandler(new ClickHandler() { ...
user avatar
213 votes
13 answers
97k views

From Apple book "One of the most important differences between structures and classes is that structures are always copied when they are passed around in your code, but classes are passed by reference....
Manish Agrawal's user avatar
154 votes
6 answers
34k views

I noticed when writing an assert in Swift that the first value is typed as @autoclosure() -> Bool with an overloaded method to return a generic T value, to test existence via the LogicValue ...
Joel Fischer's user avatar
  • 6,577
61 votes
9 answers
27k views

I'm new to Swift and I was reading the manual when I came across escaping closures. I didn't get the manual's description at all. Could someone please explain to me what escaping closures are in Swift ...
Nikhil Sridhar's user avatar
91 votes
3 answers
23k views

In Objective C it was simple: it was sufficient to update the main.m file and change the UIApplicationMain() parameters return UIApplicationMain(argc, argv, NSStringFromClass([CustomUIApplication ...
LombaX's user avatar
  • 17.4k
82 votes
7 answers
50k views

func say(name:String, msg:String) { println("\(name) say \(msg)") } say("Henry","Hi,Swift") // error: missing argument label 'msg' in call I need to use say("...
henry4343's user avatar
  • 3,931
37 votes
10 answers
8k views

For years and years, I've tried to understand the part of Java specification that deals with memory model and concurrency. I have to admit that I've failed miserably. Yes' I understand about locks and ...
user avatar
38 votes
3 answers
19k views

There are similar questions here but they are attached to a particular programming language and I am looking for an answer on the conceptual level. As I understand, Functors are essentially immutable ...
Grzegorz Piwowarek's user avatar
8 votes
3 answers
6k views

From a few initial tutorials, I see that properties belong to a Class and are essentially 'global variables' as used in the C++ world (coded in this years ago). I also see variables as more of a '...
Madhu Chamarty's user avatar
4 votes
6 answers
908 views

I am new in swift and I am following apples doc for studying it. apple doc func greet(name: String, day: String) -> String { return "Hello \(name), today is \(day)." } greet("Bob", day: "...
Pravin Tate's user avatar
  • 1,130
0 votes
2 answers
76 views

I'm new to Swift and I've read the Swift Function Documentation and as far as I understand a function has to be built this way: func funcName(param1:Type, param2:Type) -> Return { //Whatever ...
Mr.Web's user avatar
  • 7,207