Re: Trouble with non-default constructors

From: Francis Glassborow (francis_at_robinton.demon.co.uk)
Date: 07/10/04

  • Next message: Chad J McQuinn: "Re: Trouble with non-default constructors"
    Date: Sat, 10 Jul 2004 18:48:02 +0100
    
    

    In article <6d317$40eff9c2$3ea61746$1242@news2.zonnet.nl>, Peter Venis
    <petervenis@zonnet.nl> writes
    >Hi,
    >
    >I have a class that needs a non-default constructor, the class is supposed
    >to look like this:
    >
    >class MyClass
    >{
    >protected:
    > int Value;
    >public:
    > MyClass(int V);
    > ~MyClass();
    > void GetValue(){return Value);
    >};
    >
    >But if I try to compile my compilers complains there's no default
    >constructor, but I don't want a default constructor (???)

    I think you are looking in the wrong place for the problem. Unless you
    have an impossibly broken compiler it will be something in the code that
    is trying to use MyClass that is causing the error.

    -- 
    Francis Glassborow      ACCU
    Author of 'You Can Do It!' see http://www.spellen.org/youcandoit
    For project ideas and contributions: http://www.spellen.org/youcandoit/projects
    

  • Next message: Chad J McQuinn: "Re: Trouble with non-default constructors"

    Relevant Pages

    • Trouble with non-default constructors
      ... I have a class that needs a non-default constructor, ... class MyClass ... int Value; ... But if I try to compile my compilers complains there's no default ...
      (alt.comp.lang.learn.c-cpp)
    • Re: How to share data?
      ... > int getdata; ... Why is readdata() public? ... Your constructor copies the values ...
      (comp.programming)
    • Re: Object instantiation in C#
      ... >> I have a class MyClass that throws exceptions. ... > When an UNCAUGHT exception occurs in a constructor, ... > pointing to whatever it was pointing to before. ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: Trouble with non-default constructors
      ... > I have a class that needs a non-default constructor, ... > class MyClass ... > void GetValue{return Value); ... > But if I try to compile my compilers complains there's no default ...
      (alt.comp.lang.learn.c-cpp)
    • Re: How to pass information, classes between forms in Windows Application mode [ FINALLY!]
      ... access and what you're actually declaring. ... Obviously - you're referring to it in the constructor. ... Form1, but I guess I'm using the wrong lingo again. ... the program did not compile. ...
      (microsoft.public.dotnet.languages.csharp)