Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » C++

Which design in better? (Also posted in comp.lang.c++)

 
Jump to:  
 
Dave Harris
PostPosted: Tue Aug 26, 2008 3:51 pm    Post subject: Re: Which design in better? (Also posted in comp.lang.c++)
       
niteshchordiya@gmail.com (Nitesh) wrote (abridged):
Quote:
Objects of type X are basic building blocks of my application and
there are a few functions which return XHandle (typedef X**
XHandle).
The task at hand needs to use a couple of these functions and then
iterate over X objects.
Because its done frequently and it separates iteration from task-at-
hand'logic we decided to create iterator.

I don't see why you can't have a single iterator class with a suitable
constructor:

XHandleIterator::XHandleIterator( XHandle handle, int count );

and then various functions that return such iterators:

XHandleIterator makeIterator( SomeType obj );

Your first design introduces this function via a derived class, and your
second design makes it a policy, but why can't it just be a plain simple
function?

-- Dave Harris, Nottingham, UK.

--
[ See LINK for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

zdjęcia ślubne projektowanie wnętrz Ogrody zimowe, czyszczenie zęby do koparek poker