0
Nm parameter
hello i was wondering ( and it's irritating me To see it often without knowing the meaning ) what the nm in a code means ? for example in the code below! I think it means Name but why is it just "nm" ?
3 odpowiedzi
+ 4
nm is just a parameter for the constructor Car. so if u have Car("Lol") as argument, nm will be "Lol"
+ 4
if u want to leave the Car constructor blank, then u wont have to specify any constructor at all. like if u declare a Car instance u can just do new Car();
0
class Car {
string name;
public Car(string nm) {
name = nm;
Motor m = new Motor();
}
public class Motor {
// some code
}
}