"sieg1974" <> wrote...
> I'm learning how to program in C++, and I came up with a couple of
> questions.
>
> 1. Can I declare a constructor or destructor virtual? If so, please
> provide me an example where I could use it.
A constructor cannot be virtual. A destructor can. Please read your
favourite C++ book about virtual destructors. Also, it is covered in
the FAQ (
http://www.parashift.com/c++-faq-lite/).
> 2. Could a constructor be declared private? If so, how could I
> instantiate an object of this class? I think I could use friend
> methods to do it, but I'm not sure.
Yes, it can. You would leave instantiation of such class to the
class members or to the friends as you stated. Read about "named
constructor idiom" (or "the factory method"). This also is covered
in the FAQ.
Victor