N
neelsmail
Hi,
While adding a class, I usually have question: to make it static or
not. Here is an example:
class myclass {
SomeType someTypeMember;
public:
SomeOtherType DoSomething() const {
//do something with someTypeMember and return SomeOtherType
return someOtherType;
}
};
The same class can be written as (the method I don't prefer):
class myclass {
public:
static SomeOtherType DoSomething(SomeType someTypeVar) {
//do something with someTypeVar and return SomeOtherType
return someOtherType;
}
};
Is there a recommended reason why one style should be preferred than
other?
Thanks in advance,
-Neel.
While adding a class, I usually have question: to make it static or
not. Here is an example:
class myclass {
SomeType someTypeMember;
public:
SomeOtherType DoSomething() const {
//do something with someTypeMember and return SomeOtherType
return someOtherType;
}
};
The same class can be written as (the method I don't prefer):
class myclass {
public:
static SomeOtherType DoSomething(SomeType someTypeVar) {
//do something with someTypeVar and return SomeOtherType
return someOtherType;
}
};
Is there a recommended reason why one style should be preferred than
other?
Thanks in advance,
-Neel.