Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!rosebud.llnl.gov From: michael@rosebud.llnl.gov (Michael E. Slominski) Newsgroups: comp.lang.c++ Subject: Language question - static members forcing mutiple classes Message-ID: <92557@lll-winken.LLNL.GOV> Date: 5 Mar 91 19:56:09 GMT Sender: usenet@lll-winken.LLNL.GOV Organization: llnl Lines: 28 Nntp-Posting-Host: rosebud.llnl.gov I'm about halfway up the c++ learning curve and I've run across a "how do you..." problem. I have a class that looks like: class class_a { static int a_var; int b_var; member functions... } As I understand it, all objects of class_a will share a_var, and b_var will be local to each object. In my case, I am interested in b_var's value relative to a_var for each object. This works fine except that now, it turns out, I need another set of objects that do the exact same thing, except with a different a_var. The only way I've been able to do this, has been to copy class_a and rename it. I would much rather do this by using class_a as the source for both. It seems I would need to form two subclasses or derived classes of class_a that don't share a_var. I haven't been able to do this, nor have I been able to think of another alternative. If anyone knows a solution, I would be much obliged if they filled me in. Thanks in advance. -- Mike Slominski michael@rosebud.llnl.gov slominski1@llnl.gov (415) 423-6754