473,396 Members | 1,832 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.

error coming in the following code (member identifier expected)

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 2971
stdq
94 64KB
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
You just need to call in this way "f.Area()" not like this "f.void Area()".

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

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

Similar topics

7
by: Tony Tone | last post by:
I am having trouble resolving this issue: Server Error in '/test' Application. -------------------------------------------------------------------------------- Compilation Error Description:...
9
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 ] <--- ...
2
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...
4
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...
2
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
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...
0
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! ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.