Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: Static members comparison

Reply
Thread Tools

Re: Static members comparison

 
 
Victor Bazarov
Guest
Posts: n/a
 
      06-24-2003
"Dinesh Deva" <(E-Mail Removed)> wrote...
> I have a class called Parser and a static member in it called Tree
>
> class Parser
> {
> public:
> static Tree* ptree;
> void parse();
>
> };
>
>
> Now i build the tree in a variety of ways (parsing different) kinds of
> files
>
> eg AParser, BParser deriving from Parser.
>
> I want to compare the trees built by AParser and BParser. If the tree
> was not a static member, then i could do this.
>
> AParser ap;
> ap.parse();
>
> BParser bp;
> bp.parse();
>
> ap.ptree->compare(bp.ptree);
>
> But since it is static both the parsers will build the same tree.
> (replace the old tree).
>
> How do i compare the trees?
>
> I know one way to do it is to do a deep copy of the tree. (this is the
> long route).
>
> Is there any easier way?


Make the parser compare as it builds? Move the 'ptree' out of
the 'Parser' into 'AParser' and 'BParser'?..

Victor


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Thread safety problems with function scope static variables vs class static private members Hicham Mouline C++ 5 12-19-2008 08:10 PM
Difference between static final members and final static members(if any)? JFCM Java 4 02-07-2006 11:32 AM
About static const members appearing in another static const definitions Rakesh Sinha C++ 4 01-13-2005 08:11 AM
Instantiating a static class( Class with all static members - methods and variables) SaravanaKumar Java 6 10-19-2004 08:20 AM
Static classes with static members Ben ASP .Net 3 06-01-2004 07:43 PM



Advertisments