473,396 Members | 1,914 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Constructor Help!

109 100+
I have a shape SquareEx that extends Shape Square.

Expand|Select|Wrap|Line Numbers
  1. public class SquareEx extends Square {
  2.    private Color Shadow = Color.RED;   
  3.  
  4.    SquareEx(int x, int y){
  5.    super.setX(x);
  6.    super.setY(y);
  7.    }
  8.  
when i try and run, i get the error:

Error(7,26): constructor Square() not found in class Square

know why?
May 13 '08 #1
3 1302
SpecialKay
109 100+
Expand|Select|Wrap|Line Numbers
  1.  
  2. public class Square extends Shape {
  3.  
  4.    Square(int x, int y) {
  5.       setX(x);
  6.       setY(y);
  7.    }
  8.  
  9.  
here is my Square code,
May 13 '08 #2
Laharl
849 Expert 512MB
When you inherit from a class, the derived class's constructor must call the base class's constructor. If you don't explicitly call it (super(params)), then the compiler includes a call to a no-parameter constructor automatically. However, your base class has no such constructor, so it throws an error at you.
May 13 '08 #3
SpecialKay
109 100+
Solved, Much thanks. Im a noob!
May 13 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Naren | last post by:
Hello All, I get an unexpected behaviour for this class D{ /*something*/ }; class B
11
by: Amadrias | last post by:
Hi all, I am using a class to transport some data over the network. I then added the attribute to the class. My problem is that this class is part of a framework and that I do not want...
15
by: Alfonso Morra | last post by:
Hi, I have some code from an example, that I want to retrofit into my project. The code from the example has the following line: SharedAppenderPtr myAppender( new...
6
by: Ook | last post by:
Can some kind soul explain this line? I'm not quite sure what the different parts do and exactly how it works. public: // Constructors Zoot(int size = 0) : _size(size), _data(_size ? new int...
3
by: anddos | last post by:
ive got this sample from a book i am learning from c++ , and need abit of help on constructor #ifndef CAR_HPP #define CAR_HPP class Car { public: Car(); Car(int initRadioFreq, int...
45
by: Ben Blank | last post by:
I'm writing a family of classes which all inherit most of their methods and code (including constructors) from a single base class. When attempting to instance one of the derived classes using...
0
by: Eric_Dexter | last post by:
Is there a way to convert from .pdf to hhp so that I can add help files to boa constructor.. adding html to it would also be helpfull http://www.dexrow.com
3
by: izzyk | last post by:
Can someone please show me how I would create these constructors in the source file...my compiler tells me I have errors. I know I set up my main, header, and source file correctly because I am...
0
by: atencorps | last post by:
Hello I have the following code but need some help on it. The idea of the code is the main sections ie Service Management are viewable when the page is loaded and by clicking on the main...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.