[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ProgSoc] dumbass c++ q



urgh my brain's melting; but I got a probably trivial c++ question:

I have a constructor for a class, lets call it foo:

foo::foo(int a, int b, bool c, string d) {some_code(here);}

and I have another constructor for foo which takes an aggregate type, say
bar:

class bar{
	int a;
	int b;
	bool c;
	string d;
};

foo::foo(bar b){
	foo(b.a, b.b, b.c, b.d);
}

is this legit? i.e. can I call a constructor from within another
constructor?

chow

vik

<http://www.progsoc.org/~vik>
PGP: <http://www.progsoc.org/~vik/pgp.txt>

"I think it would be a good idea." Ghandi, on Western Civilisation


-
You are subscribed to the progsoc mailing list. To unsubscribe, send a
message containing "unsubscribe" to progsoc-request@nospam.progsoc.uts.edu.au.
If you are having trouble, ask owner-progsoc@nospam.progsoc.uts.edu.au for help.