CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: constructor

  1. #1
    Join Date
    Oct 2000
    Posts
    1

    constructor

    i'm extending the class Canvas and would like to be able to force the construction of it and all it's super classes. is there a way to do this? i would like to do this because i'd like to use createImage(int,int) in the constructor(double buffering) but can't because i get a null exception so i have to do something that looks a little hacky to accomplish the same thing.

    thanks


  2. #2
    Join Date
    Sep 2000
    Location
    Texas
    Posts
    22

    Re: constructor

    you can use the super

    keyword to access the class that you have extended your new class from, using this you can call the constuctor for the class..
    also check this out for help:
    http://java.sun.com/docs/books/tutor.../subclass.html




    "There are no facts, only interpretations."
    -Friedrich Nietzsche

  3. #3
    Join Date
    Jan 2000
    Location
    Canada
    Posts
    249

    Re: constructor

    Canvas has 2 constructors. The first one accepts no parameters and the second one accepts a GraphicsConfiguration object. If you want to call the constructor for Canvas and its super classes, put the following line

    super();

    as the first line in your constructor. This is an explicit call to the super classes constructor.

    -------------------------------------------
    weaver
    icq# 64665116
    Please rate this post.
    http://weaver.x7.htmlplanet.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured