Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror

Comment Re:Complex Question... (Score 1) 621

You're confusing OO techniques with classes.
It's perfectly legal and moral to use classes to organise your code to clean up your example, with no requirement that you also put it into an inheritance heirarchy...
As a random example, consider the named constructor idiom:
class Pipe{
public:
Pipe Round(); //factory to create a Round pipe
Pipe Square(); //factory to create a Square pipe

Pipe & operator = (const Pipe &); //assignment operator
Pipe(const Pipe &); //copy constructor

private:
Pipe(); //constructor is private
};

Pipe roundedPipe = Pipe::Round();


(Notice the pass-by-value semantics you get too...)

-ShunScene

Slashdot Top Deals

/earth: file system full.

Working...