Tag: Constructor
Posts of Tag: Constructor
  1. Difference Between Constructor and Destructor

    **Difference Between Constructor and Destructor** Constructor and Destructor are the special methods which makes our crucial tasks easier while programming. If you have ever worked in programming language like ...Learn More
    ClassConstructorDestructor
  2. Default parameters with C++ constructors

    Is it good practice to have a class constructor that uses default parameters, or should I use separate overloaded constructors? For example: // Use this... class foo { private: std::string name_; uns...Learn More
    c++Constructorcoding-styleOverloading
  3. How do you call a constructor for global objects, for arrays of objects, and for objects inside classes/structs?

    How would you call the constructor of the following class in these three situations: Global objects, arrays of objects, and objects contained in another class/struct? The class with the constructor (used in all...Learn More
    c++OOPConstructor
  4. Error when using a Python constructor

    class fileDetails : def __init__(self,host,usr,pwd,database): self.host=host self.usr.usr self.pwd=pwd self.database=database def __init__(self,connection,sql,path): ...Learn More
    PythonConstructorProgramming Languages
  5. What is a basic example of single inheritance using the super() keyword in Python?

    Let's say I have the following classes set up: class Foo: def __init__(self, frob, frotz): self.frobnicate = frob self.frotz = frotz class Bar: def __init__(self, frob, frizzle): ...Learn More
    PythonInheritanceConstructorSuperProgramming Languages
  6. dojo: inheritance with default value - the mixin doesn't happen

    I wish to declare a new dojo class inheriting from an existing dojo class, but with my own choice of default values for the class's properties. (The user can still override those values.) I am declaring my own...Learn More
    InheritanceConstructorDojomixinsDeclare
  7. Constructor arguments problem ActionScript 3

    I have a custom class defined in Actionscript and I want to make an instance of it in the main document of Flash application. However, after calling the constructor with one argument, Flash gives me this error:...Learn More
    actionscript-3ConstructorArguments
  8. DataContractSerializer doesn't call my constructor?

    I just realized something crazy, which I assumed to be completely impossible : when deserializing an object, the DataContractSerializer doesn't call the constructor ! Take this class, for instance : [DataContra...Learn More
    C#.NETConstructorSerializationdatacontractserializerProgramming LanguagesFramework
  9. Calling methods in super class constructor or subclass constructor?

    1. Passing configuration to the __init__ method which calls register implicitely: class Base: def __init__(self, *verbs): if not verbs: verbs = "get", "post" self._register(verbs)...Learn More
    PythonOOPConstructorProgramming Languages
  10. DAL Design/Load methods with NHibernate

    public MyClass(int someUniqueID) { using(//Session logic) { var databaseVersionOfMyClass = session.CreateCriteria(/*criteria*/) .UniqueResult<MyClass>(); //Load logic ...Learn More
    C#NhibernateConstructorinstancedata-access-layerProgramming Languages
  11. How to make the class constructor private in Ruby?

    class A private def initialize puts "wtf?" end end A.new #still works and calls initialize and class A private def self.new super.new end end doesn't work altogether So what's the correct way...Learn More
    RubyConstructoraccess-specifier
  12. Who deletes the memory allocated during a "new" operation which has exception in constructor?

    I really can't believe I couldn't find a clear answer to this... How do you free the memory allocated after a C++ class constructor throws an exception, in the case where it's initialised using the new operator...Learn More
    c++Exceptionmemory-leaksConstructor