About 42,300,000 results
Open links in new tab
  1. C++, What does the colon after a constructor mean?

    May 7, 2010 · An initializer list is how you pass arguments to your member variables' constructors and for passing arguments to the parent class's constructor. If you use = to assign in the …

  2. How to initialize a list with constructor? - Stack Overflow

    Feb 1, 2012 · Please guide me is among best practices to use constructor with for list initialization? How to assign values to list using a constructor, so if no value passed a default …

  3. What are the rules for calling the base class constructor?

    Apr 4, 2021 · What are the C++ rules for calling the base class constructor from a derived class? For example, I know in Java, you must do it as the first line of the subclass constructor (and if …

  4. When is it right for a constructor to throw an exception?

    The constructor's job is to bring the object into a usable state. There are basically two schools of thought on this. One group favors two-stage construction. The constructor merely brings the …

  5. Using C++ base class constructors? - Stack Overflow

    Nov 11, 2011 · While working with templates I ran into a need to make a base class constructors accessible from inherited classes for object creation to decrease copy/paste operations. I was …

  6. JSON.net: how to deserialize without using the default constructor?

    I have a class that has a default constructor and also an overloaded constructor that takes in a set of parameters. These parameters match to fields on the object and are assigned on …

  7. Constructor overload in TypeScript - Stack Overflow

    Oct 3, 2012 · I want to do constructor overloading in TypeScript. On page 64 of the language specification (v 0.8), there are statements describing constructor overloads, but there wasn't …

  8. Can an abstract class have a constructor? - Stack Overflow

    Nov 4, 2008 · The same case applies to abstract classes. Though we cannot create an object of an abstract class, when we create an object of a class which is concrete and subclass of the …

  9. C# : assign data to properties via constructor vs. instantiating

    Oct 2, 2013 · Would you really want to have a constructor that has 20 different properties - especially when you only want to actually define one or two? Secondly, default values don't …

  10. Can a struct have a constructor in C++? - Stack Overflow

    Sep 10, 2023 · In C++ the only difference between a class and a struct is that members and base classes are private by default in classes, whereas they are public by default in structs. So …