cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Lounge
Is it always necessary to make default c
Is it always necessary to make default constructor for a class?
Mar 15, 2014 at 10:09pm UTC
stdeez
(70)
Is there a reason to always make a default, or no parameter constructor? If so what convenient purpose does it serve? I'm writing a graph class right now and I'm wondering why I would ever want to use an object with all values meaningless?
Mar 15, 2014 at 10:11pm UTC
LB
(13399)
You only need a default constructor if you want your class to be default-constructible. Some containers and functions require this, others don't.
Topic archived. No new replies allowed.