J
Jim Langston
It is common, and generally a good idea, to have setters and getters for
class variables. I.E.
class MyClass
{
public:
void SetShutdown( const bool sd ) { Shutdown = sd; };
bool GetShutdown() { return Shutdown };
private:
bool Shutdown;
};
What I'm contemplating is instead of set and get simply overriding:
class MyClass
{
public:
void shutdown( bool sd ) { Shutdown = sd; };
bool shutdown() { return Shutdown; };
private:
bool Shutdown;
};
Now, this is strictly a style question, and it gets a little confusing with
the only difference between the function and the variable the capital 'S'.
But do you, personally, think this style is a good idea and do you like it?
Or can you think of some other way instead of SetXxxxx() and GetXxxxxx() ?
class variables. I.E.
class MyClass
{
public:
void SetShutdown( const bool sd ) { Shutdown = sd; };
bool GetShutdown() { return Shutdown };
private:
bool Shutdown;
};
What I'm contemplating is instead of set and get simply overriding:
class MyClass
{
public:
void shutdown( bool sd ) { Shutdown = sd; };
bool shutdown() { return Shutdown; };
private:
bool Shutdown;
};
Now, this is strictly a style question, and it gets a little confusing with
the only difference between the function and the variable the capital 'S'.
But do you, personally, think this style is a good idea and do you like it?
Or can you think of some other way instead of SetXxxxx() and GetXxxxxx() ?