Here is a quote from the book: C++ Annotations,
I don't understand these sentences, could anybody help me?
thanks!
As a side effect to this implementation it must be stressed that it is
not anymore correct to declare
iostream objects using standard forward declarations, like:
class ostream; // now erroneous
Instead, sources that must declare iostream classes must
#include <iosfwd// correct way to declare iostream classes 6 2883
Luna Moon wrote:
Here is a quote from the book: C++ Annotations,
I don't understand these sentences, could anybody help me?
thanks!
As a side effect to this implementation it must be stressed that it is
not anymore correct to declare
iostream objects using standard forward declarations, like:
class ostream; // now erroneous
Instead, sources that must declare iostream classes must
#include <iosfwd// correct way to declare iostream classes
iostream is a typedef for a template.
--
Ian Collins
On Oct 22, 5:54*pm, Ian Collins <ian-n...@hotmail.co mwrote:
Luna Moon wrote:
Here is a quote from the book: C++ Annotations,
I don't understand these sentences, could anybody help me?
thanks!
As a side effect to this implementation it must be stressed that it is
not anymore correct to declare
iostream objects using standard forward declarations, like:
class ostream; // now erroneous
Instead, sources that must declare iostream classes must
#include <iosfwd// correct way to declare iostream classes
iostream is a typedef for a template.
--
Ian Collins
Still don't understand? What does that lead to?
Luna Moon wrote:
On Oct 22, 5:54 pm, Ian Collins <ian-n...@hotmail.co mwrote:
>Luna Moon wrote:
>>Here is a quote from the book: C++ Annotations, I don't understand these sentences, could anybody help me? thanks! As a side effect to this implementation it must be stressed that it is not anymore correct to declare iostream objects using standard forward declarations, like: class ostream; // now erroneous Instead, sources that must declare iostream classes must #include <iosfwd// correct way to declare iostream classes
iostream is a typedef for a template.
*Plese* dont quote signatures.
>
Still don't understand? What does that lead to?
You can't forward declare something that's a typedef. If the compiler sees
class ostream;
then
typedef basic_ostream<c harostream;
it will two different declarations of ostream.
Try a simple example:
struct Wibble;
struct X
{
Wibble* wibble;
};
template <typename Tstruct Z {};
// Uncomment each of these and see what happens.
//
//typedef Z<intWibble;
//struct Wibble {};
int main()
{
X x;
}
--
Ian Collins
On Oct 23, 2:46 am, Luna Moon <lunamoonm...@g mail.comwrote:
Here is a quote from the book: C++ Annotations,
I'm curious: which book? (I ask because while fully
understandable, the text you quote was obviously not written by
a native speaker. And any decent publishing house would have
gotten it cleaned up.)
I don't understand these sentences, could anybody help me?
As a side effect to this implementation it must be stressed
that it is not anymore correct to declare iostream objects
using standard forward declarations, like:
class ostream; // now erroneous
Instead, sources that must declare iostream classes must
#include <iosfwd// correct way to declare iostream classes
Well, it says what it says: traditionally, most header files
didn't include <iostream.h>; they just forwarded declared the
classes from it that they needed. Because in the standard,
istream and ostream are not classes, however, this technique is
no longer legal, and in modern C++, you have to include <iosfwd>
instead.
--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
//typedef Z<intWibble;
//struct Wibble {};
I tried. The first one didn't compile and the second one did compile
on my VC++ Express 2008.
What does that mean?
Luna Moon wrote:
>//typedef Z<intWibble;
//struct Wibble {};
I tried. The first one didn't compile and the second one did compile
on my VC++ Express 2008.
What does that mean?
Pay heed to the error the compiler gave you. I thought I'd explained
why you can't forward declare a typedef.
--
Ian Collins This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: user |
last post by:
Hi.
Sorry for the probable dumbness of my question, but the behaviour I'm
observing seems a blatant defect in the C++ Standard or in the
implementation I'm using (several different versions of GCC, all
behaving exactly the same, GNU binutils, GNU/Linux on PowerPC).
Let's say I have two compilation units, a.cc and b.cc; each of them
need to perform some initialization (or finalization, for what it
matters) which I want to be transparent,...
|
by: Leslaw Bieniasz |
last post by:
Cracow, 28.10.2004
Hello,
I have a program that intensively allocates and deletes lots
of relatively small objects, using "new" operator. The objects
themselves are composed of smaller objects, again allocated using "new".
From my tests I deduce that a considerable part of the computational
time is spent on the memory allocation, which makes the program
substantially slower compared to the equivalent code written using
|
by: H. S. |
last post by:
I am getting this error if I try to compile the file demarcated below.
What I am missing here? I am using g++ (GCC) 3.3.5 (Debian 1:3.3.5-8).
{tp2}> g++ -ansi -g -Wall tp2.cc -o tp2
tp2.cc: In member function `void Other::DoSomething()':
tp2.cc:11: error: `int Base::iX' is protected
tp2.cc:29: error: within this context
// %< %< ----------------------------------- %< %<
|
by: NewToCPP |
last post by:
I am having some trouble including "iostream" "fstream" to my code.
I tried the following ways and base times it did not work. What is the
problem?
test.cc:
=======
.....
#include <iostream.h>
#include <fstream.h>
|
by: silversurfer2025 |
last post by:
Hello everyone,
I am currently having problems with a C++ abstract class. I have a
class FrameWork.h which defines some methods (of which some are
abstract, i.e. virtual void method() = 0). In FrameWork.cpp I define
some of the methods while I naturally leave the abstract methods
undefined. Now I wrote a class FrameWork_GUI.h which inherits from the
abstract FrameWork class and implements the missing (so far abstract)
methods....
| |
by: subramanian100in |
last post by:
Is my following understanding correct ?
Data abstraction means providing the interface - that is, the set of
functions that can be called by the user of a class.
Information hiding means mentioning the class members(functions,
typedefs, data) under the access control labels : public, protected,
private.
Encapsulation means providing the implementation of class member
|
by: Colonel |
last post by:
It seems that the problems have something to do with the overloading of
istream operator ">>", but I just can't find the exact problem.
// the declaration
friend std::istream & operator>(std::istream & in, const Complex & a);
// the methods correspond to the friend
std::istream & operator>(std::istream & in, const Complex & a)
{
std::cout << "real: ";
|
by: hill.liu |
last post by:
Hi,
I stuck into this problem that I can't figure it out.
Here is the class definition:
class ctest {
public:
ctest(void) { cout << "ctest default constor" << endl; };
ctest(ctest& c) { cout <<"ctest copy constr" << endl; };
ctest(int a) { cout <<"ctest int constor" <<endl; };
|
by: Bill Davy |
last post by:
I want to be able to write (const char*)v where v is an item of type
Class::ToolTypeT where ToolTypeT is an enumeration and I've tried
everything that looks sensible. There's an ugly solution, but surely this is
possible?
I could define an operator<< but for various reasons, I really want to
convert to a 'const char*' (to embed into a string which becomes part of a
window's caption, etc).
|
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...
|
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,...
| |
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...
|
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...
|
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,...
|
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...
|
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();...
|
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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |