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::draw Line (double x1, double y1, double x2, double y2) {
DPOne.draw_a_li ne(x1, y1, x2, y2); ###error###
}
void V1Drawing::draw Circle (double x, double y, double r) {
DPOne.draw_a_ci rcle(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_l ine(double x1, double y1, double x2, double y2) {
...
}
void DPOne::draw_a_c ircle(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 3 41186
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::draw Line (double x1, double y1, double x2, double y2)
{ DPOne.draw_a_li ne(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
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::draw Line (double x1, double y1, double x2, double y2) {
DPOne.draw_a_li ne(x1, y1, x2, y2); ###error###
DPOne::draw_a_l ine(x1, y1, x2, y2);
}
void V1Drawing::draw Circle (double x, double y, double r) {
DPOne.draw_a_ci rcle(x, y, r); ###error###
DPOne::draw_a_c ircle(x, y, r);
}
You should throw out your C++ book and get a better one instead if it
doesn't explain this.
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::draw Line (double x1, double y1, double x2, double y2) { DPOne.draw_a_li ne(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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 the following context:
class Spam(object): pass
class Spammer(object):
|
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>
> <password>brown</password>
> </userlogin>
> Above is my schema instance.
|
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 nodes in the instance unqualified. An example of the document is
below:
<?xml version="1.0" encoding="utf-8" ?>
<filingreceipt...
|
by: junky_fellow |
last post by:
What are the qualified and unqualified types in C ?
|
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 subsequent function in the same file I want to create a
connection by entering the following line:
SqlClient.SqlConnection cn = new
| |
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 xmlns:s0="myns">
<ChildElement></ChildElement>
</s0:rootelement >
|
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
to define elements in this way....it seems it will influence XPATH /
XSLT, etc...
|
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, and the default namespace needs to be included on it
as an attribute. The schema I'm using is this:
<xs:schema...
|
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'
|
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()?
|
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...
| |
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...
|
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. ...
|
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...
|
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...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |