473,604 Members | 2,481 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error coming in the following code (member identifier expected)

1 New Member
Expand|Select|Wrap|Line Numbers
  1. #include<iostream.h>
  2. #include<conio.h>
  3. class figure
  4.     {
  5.     public:
  6.         virtual void Area();
  7.     };
  8. class square:public A
  9.     {
  10.     public:
  11.         void Area()
  12.             {
  13.             int side,x;
  14.             cout<<"\nEnter the SIDE of the square\t";
  15.             cin>>side;
  16.             x=side*side;
  17.             cout<<"\nThe AREA of the SQUARE is\t"<<x;
  18.             }
  19.     };
  20. class Rectangle:public figure
  21.     {
  22.     public:
  23.         void Area()
  24.             {
  25.             int l,b,y;
  26.             cout<<"\nEnter the LENGTH of the rectangle\t";
  27.             cin>>l;
  28.             cout<<"\nEnter the BREADTH of the rectangle\t";
  29.             cin>>b;
  30.             y=l*b;
  31.             cout<<"\nThe AREA of the rectangle is\t"<<y;
  32.             }
  33.     };
  34. class Traingle:public figure
  35.     {
  36.     public:
  37.         void Area()
  38.             {
  39.             int b1,h,z;
  40.             cout<<"\nEnter the BREADTH of the traingle\t";
  41.             cin>>b1;
  42.             cout<<"\nEnter the HIEHGHT of the traingle\t";
  43.             cin>>h;
  44.             z=0.5*b1*h;
  45.             cout<<"\nThe AREA of the traingle is\t"<<z;
  46.             }
  47.     };
  48. void main()
  49.     {
  50.     clrscr();
  51.     figure f;
  52.     square s;
  53.     Traingle t;
  54.     Rectangle r;
  55.     f.void Area();
  56.     s.void Area();
  57.     t.void Area();
  58.     r.void Area();
  59.     getch();
  60.     }
Apr 30 '14 #1
2 2988
stdq
94 New Member
In line 8, you inherit from class A. Where is that class defined? Also, in which line(s) does the compiler/linker tells the error is in?
Apr 30 '14 #2
maya29988
7 New Member
You just need to call in this way "f.Area()" not like this "f.void Area()".

syntax should be object.<functio nName>
May 2 '14 #3

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

Similar topics

7
12879
by: Tony Tone | last post by:
I am having trouble resolving this issue: Server Error in '/test' Application. -------------------------------------------------------------------------------- Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
9
17370
by: Jack | last post by:
I get the following errors from the code ( CRM 3.0 ) below, whats wrong ? Any suggestions are welcome because i'm kinda stuck here. The first error is pointing on the last bracket ] <--- c:\inetpub\wwwroot\bredanaweb\jdshentlead.aspx.cs(18,35): error CS1001: Identifier expected
2
8772
by: jdziggy | last post by:
Hey all I am getting the compiler Identifier Expected on the following code. public partial class Form1 : Form { private const int MaxFiles = 10; private SourceFile m_sourceFiles(MaxFiles); private int m_files = 0; public Form1() {
4
1118
by: zaperaj | last post by:
Im working with python2.2 on red hat linux. The following program is supposed to print decreasing numbers from an entered number till 1, each decrement being = 1 : #! usr/bin/env/python def f(n=int(raw_input("enter number: "))): print 'n=',n if n>1: return n*f(n-1)
2
3700
by: roymunia200 | last post by:
i wrote this program.after compiling it gave this error.for more i'm writing the program..... #include<iostream.h> class student { private: char name; int marks; public: void setinfo(void);
2
2844
by: Gnapika | last post by:
public class HelloWorldBean implements HelloWorld { public void sayHello(String name); System.out.println("Hello, World"); } This is the code i want to execute but it is showing an error like <identifier>expected..
0
1950
by: JJE990 | last post by:
Hi there! I'm having a small problem with my coding. I am new to this level of VB coding, and coding in general really, the only coding I've ever done in VB is to make a simple login manager! Anyway, I am getting the errors that are mentioned in the title. Here is my code: Imports System.Net Imports System.IO Imports System.Security.Policy
0
7929
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
8419
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8065
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
8280
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
6739
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5441
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
3955
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1526
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1266
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.