473,761 Members | 8,813 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help extending Shape class with Circle and Rectangle classes

74 New Member
I am a little confused about what I need to do here. I created four separate classes (Circle, Rectangle, Square, and Triangle) that each calculate their own area and perimeter via user input.

Now I have to extend the Shape class with Circle and Rectangle classes, first. Then, I have to extend Rectangle with Square and Triangle classes.

Was I supposed to calculate the area and perimeter of the four shapes in the Shape class, or did I do it right? What should be in the Shape class?

How do I extend the things above? I know you have to write public class Circle extends Shape, but do I have to put anything else in the body of the class for Shape?

Sorry about all the questions, but I am so confused about what I have to do. If anybody can help me, it would be greatly appreciated, and thanks in advance!

If you need to see code, let me know!
Oct 30 '06 #1
1 2991
elangovasanthan
1 New Member
you please upload the code...


then only we can find a solution...




Regards ,

ElangoVasanthan ...
Oct 31 '06 #2

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

Similar topics

12
2089
by: Anthony Jones | last post by:
Just a bit of background: I'm one of a group of FORTRAN programmers, looking to switch to C++. We are trying to write a few simple examples to demonstrate the power of the language to our manager, so he will send us all on a conversion course. One of many reasons is that our code is littered with examples of: SUBROUTINE PRINT_ITEM(ITEM, ITEM_TYPE) IF (ITEM_TYPE .EQ. SQUARE) THEN CALL PRINT_SQUARE(ITEM)
9
4996
by: Banaticus Bart | last post by:
I wrote an abstract base class from which I've derived a few other classes. I'd like to create a base class array where each element is an instance of a derived object. I can create a base class pointer which points to an instance of a derived class, but when I pass that base class pointer into a function, it can't access the derived object's public functions. Although, the base class pointer does call the appropriate virtual function...
5
2518
by: Mark | last post by:
I can't seem to get this subclass to upcast to a baseclass... see comments below #include <cstdlib> #include <iostream> #include "Base.h" #include "Sub1.h" using namespace std;
3
2642
by: Dean Craig | last post by:
I'm working with the new ASP.NET AJAX Control Toolkit. I have a map that has several key areas (hot spots) where when the user hovers over them, I want to pop up a small window with information in it (text, graphics, whatever). I am using the asp:ImageMap control and I can use the asp:circlehotspot control, but that only allows me to have a single hotspot. What I want to do is create a new custom control that derives everything from...
2
7249
by: Angus | last post by:
Hello I have some classes defined in shapes.h and use them like this: const IShape* rectangle = new Rectangle(10.0, 20.0); // width, height cout << rectangle->calculateArea() << endl; delete rectangle; // causes error C2665 error
9
1710
by: Chrissy | last post by:
I took a C# class as an elective and received an incomplete in it and am desparate for help. I have two assignments left (arrays and inheritance) and would gladly pay anyone that can assist me with this. I want you to know that I'm a 41 year old mother of three boys (ages 9, 7, and 2) and have done my very best to muddle through this course. Sadly, my old brain is not equipped to handle it. LOL Chrissy
12
3014
by: adamurbas | last post by:
ya so im pretty much a newb to this whole python thing... its pretty cool but i just started today and im already having trouble. i started to use a tutorial that i found somewhere and i followed the instructions and couldnt get the correct results. heres the code stuff... temperature=input("what is the temperature of the spam?") if temperature>50: print "the salad is properly cooked." else:
3
2259
by: hjast | last post by:
I am doing an assingment for class and I have everything execpt it will not compile. I get these errors /Users/hjast89/Desktop/test/shape.cpp:36: error: expected `}' at end of input /Users/hjast89/Desktop/test/shape.h:25: error: virtual outside class declaration /Users/hjast89/Desktop/test/shape.h:25: error: function 'void draw()' is initialized like a variable /Users/hjast89/Desktop/test/shape.cpp:15: error: a function-definition...
3
1328
by: hjast | last post by:
test has exited due to signal 10 (SIGBUS). This is the circle class #include <iostream.h> class Shape {
0
9554
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9376
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9988
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9923
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9811
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3911
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3509
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.