473,399 Members | 3,656 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,399 software developers and data experts.

expected unqualified-id before "." token?

Hi,
I was wondering if someone had any insight to what I am doing wrong. I
ve got a class with two methods that call static methods of another
class. When compiling my sourcecodes I get the error `expected
unqualified-id before "." token` for the two static function calls:

....
void V1Drawing::drawLine (double x1, double y1, double x2, double y2) {
DPOne.draw_a_line(x1, y1, x2, y2); ###error###
}

void V1Drawing::drawCircle (double x, double y, double r) {
DPOne.draw_a_circle(x, y, r); ###error###
}
....

---DPOne.h---
#ifndef DP1_H_
#define DP1_H_

class DPOne {
public:
DPOne();
virtual ~DPOne();

static void draw_a_line (double x1, double y1, double x2, double y2);
static void draw_a_circle (double x, double y, double r);
};

#endif /*DP1_H_*/
---/DPOne.h---
---DPOne.cpp---
#include "DPOne.h"

DPOne::DPOne() {
}

DPOne::~DPOne() {
}

void DPOne::draw_a_line(double x1, double y1, double x2, double y2) {
...
}

void DPOne::draw_a_circle(double x, double y, double r) {
...
}
---/DPOne.cpp---
I use gcc 4.0.3 on a Linux system. Any idea what the problem is?
Thomas B
Jul 18 '06 #1
3 41164
Thomas Barth wrote:
Hi,
I was wondering if someone had any insight to what I am doing wrong. I
ve got a class with two methods that call static methods of another
class. When compiling my sourcecodes I get the error `expected
unqualified-id before "." token` for the two static function calls:

...
void V1Drawing::drawLine (double x1, double y1, double x2, double y2)
{ DPOne.draw_a_line(x1, y1, x2, y2); ###error###
To call a static member of a class you use '::', not '.' after the class
name. What book are you reading that doesn't explain that?
}
[...]
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 18 '06 #2
Thomas Barth wrote:
Hi,
I was wondering if someone had any insight to what I am doing wrong. I
ve got a class with two methods that call static methods of another
class. When compiling my sourcecodes I get the error `expected
unqualified-id before "." token` for the two static function calls:

...
void V1Drawing::drawLine (double x1, double y1, double x2, double y2) {
DPOne.draw_a_line(x1, y1, x2, y2); ###error###
DPOne::draw_a_line(x1, y1, x2, y2);
}

void V1Drawing::drawCircle (double x, double y, double r) {
DPOne.draw_a_circle(x, y, r); ###error###
DPOne::draw_a_circle(x, y, r);
}
You should throw out your C++ book and get a better one instead if it
doesn't explain this.

Jul 18 '06 #3
Victor Bazarov wrote:
Thomas Barth wrote:
>Hi,
I was wondering if someone had any insight to what I am doing wrong. I
ve got a class with two methods that call static methods of another
class. When compiling my sourcecodes I get the error `expected
unqualified-id before "." token` for the two static function calls:

...
void V1Drawing::drawLine (double x1, double y1, double x2, double y2)
{ DPOne.draw_a_line(x1, y1, x2, y2); ###error###

To call a static member of a class you use '::', not '.' after the class
name. What book are you reading that doesn't explain that?
My book is at home... confused by Java... 32° Celsius...

Thanks anyway :-)

Thomas B
Jul 18 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: j vickroy | last post by:
Could someone help me understand the following Python 2.3 error message: SyntaxError: unqualified exec is not allowed in function 'load' it contains a nested function with free variables in...
0
by: C. M. Sperberg-McQueen | last post by:
wooks (wookiz@hotmail.com) wrote: > <?xml version='1.0'?> > <userlogin xmlns="urn:faster:userlogin" > xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> > <login>mick</login> > ...
4
by: Erik Moore | last post by:
I am both producing and parsing an xml document that needs to be validated against a schema. I wanted some consumers of the document to have the option of not performing a validation, so I left the...
1
by: junky_fellow | last post by:
What are the qualified and unqualified types in C ?
2
by: Jeff S | last post by:
I have the following three lines at the very top of a class file (prior to the namespace declaration line). using System; using System.Data; using System.Data.SqlClient; Then, in a...
1
by: Simon | last post by:
Hi - I have a webservice with WSDL specifying 'elementFormDefault' set to 'unqualified'. I find when I try to process the incoming XML the raw XML either looks like this: <s0:rootelement...
3
by: mavis | last post by:
Unqualified element in XSD definition For some reason, we may need to define elements in XSD to be "unqualified". According to the design patterns of XSD, it seems they do not recommend ...
9
by: Mark Olbert | last post by:
I'm trying to serialize (using XmlSerializer.Serialize) a class that I generated from an XSD schema using XSD.EXE /c. The problem I'm running into is that the root element needs to be unqualified,...
0
by: Stef Mientki | last post by:
hello, I've syntax error which I totally don't understand: ########## mainfile : import test_upframe2 if __name__ == '__main__': var1 = 33 code = 'print var1 + 3 \n'
0
by: Terry Reedy | last post by:
Stef Mientki wrote: Indendation is screwed. Is the above all do_more body? Which locals does this get you? __init__'s? (locals()?) Isn't this just the same as globals()?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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...
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,...

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.