J
JustSomeGuy
class x,y
{
public:
.....
private:
};
{
public:
.....
private:
};
No. You can have one base class containing commonJustSomeGuy said:class x,y
{
public:
....
private:
};
JustSomeGuy said:class x,y
{
public:
....
private:
};
Thomas Matthews said:No. You can have one base class containing common
stuff and have the two inherit from it:
class base
{
// ...
};
class x
: public base
{
// ...
};
class y
: public base
{
// ...
};
Or you can have two instances of one class:
class common
{
} x, y; // two variable of class common.
Or you can throw the common stuff into
a template.
JustSomeGuy said:class x,y
{
public:
....
private:
};
Gianni Mariani said:Thomas's post covers most of it.
One thing he left out was typedefs.
class x
{
public:
....
private:
};
typedef x y;
Now, x and y are exactly the same. However, y is really class x.
Eugene said:They are not exactly the same.
While you can declare x in a forward declaration as a class,
you cannot do the same for y:
Eugene Alterman said:They are not exactly the same.
While you can declare x in a forward declaration as a class, you cannot do
the same for y:
class x; // ok
class y; // error
JustSomeGuy said:class x,y
{
public:
....
private:
};
JustSomeGuy said:class x,y
{
public:
....
private:
};
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.