473,386 Members | 1,823 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,386 software developers and data experts.

class B : virtual public A

I read "thinking in C++" but I don't understand how the pointers stored
in vtable of SeekableInputOutputStream.
Can you explain me the order please?

Thanks a lot!
---------------------------------------
class InputStream
{
public:
virtual int read(void *base, int size) = 0;
};

class OutputStream
{
public:
virtual int write(void *base, int size) = 0;
};

class Seekable
{
public:
virtual bool seek(int pos, char* origin) = 0;
virtual int size() = 0;
};

class SeekableInputStream : public InputStream, virtual public Seekable {}

class SeekableOutputStream : public OutputStream, virtual public Seekable {}

class SeekableInputOutputStream : virtual public SeekableInputStream,
virtual public SeekableOutputStream {}
--------------------------------------
Jan 3 '07 #1
3 2157
Sorry!

Instead of
class SeekableInputOutputStream : virtual public SeekableInputStream,
virtual public SeekableOutputStream {}
use
class SeekableInputOutputStream : public SeekableInputStream, public
SeekableOutputStream {}
Jan 3 '07 #2
Hello!

Chameleon wrote:
I read "thinking in C++" but I don't understand how the pointers stored
in vtable of SeekableInputOutputStream.
Can you explain me the order please?
What vtable? vtables aren't part of C++. An /implementation/ of C++
/might/ use vtables, but you don't need to worry about that (unless
you're, say, a compiler developer). Even if your implementation of C++
happens to use vtables, you shouldn't need to worry about the details.
Why do you want to know about vtables?

Simon

--
What happens if I mention Leader Kibo in my .signature?
Jan 3 '07 #3
Chameleon wrote:
I read "thinking in C++" but I don't understand how the pointers
stored in vtable of SeekableInputOutputStream.
Can you explain me the order please?
Why do you care? 'vtable' is an implementation detail. When
writing C++ code you needn't concern yourself with those.

If you do need to know the implementation details like that, you
should consider posting to the newsgroup for your compiler. There
is also "Inside the C++ Object Model" book by Stanley B. Lippman,
check it out.
[..]
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jan 3 '07 #4

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

Similar topics

4
by: Ronnie | last post by:
Please look at the code below, class BaseCol { public: virtual void a() { cout << "BaseCol::a" << endl; } virtual void b() { cout << "BaseCol::b" << endl; } }; class ChildCol1 : public...
9
by: Banaticus Bart | last post by:
I wrote an abstract base class from which I've derived a few other classes. I'd like to create a base class array where each element is an instance of a derived object. I can create a base class...
2
by: gg | last post by:
I am facing some problems with following program. I am using aCC version 03.27 on HP-UX11. The command line I use to compile is - aCC -AA -I. TestTempMethods.C Can anybody pls suggest how to...
0
by: big A | last post by:
I am receiving an error stating that File or Assembly name <filname.dll>, or one of its dependencies, was not found In one assembly I have three abstract classes In another I have three...
2
by: Jessica | last post by:
I have a base class and a derived class, but I am getting errors when I try to access functions of the derived class. Simplified version of my code is as follows: //////////////// // test2.hh...
5
by: Dennis Jones | last post by:
Hello, I have a couple of classes that look something like this: class RecordBase { }; class RecordDerived : public RecordBase {
1
by: neoairus | last post by:
I'm developing a pseudo-library for neural network. To simplify librarary using i wont to implement a sistem to instantiate different implementation of interface(Layer.h Neuron.h) passing a string...
3
by: TamusJRoyce | last post by:
Hello. This is my first thread here. My problem has probably been came across by a lot of people, but tutorials and things I've seen don't address it (usually too basic). My problem is that I...
1
by: Stodge | last post by:
Yet another SWIG question (YASQ!). I'm having a problem with using an abstract base class. When generating the Python bindings, SWIG thinks that all the concrete classes that derive from this...
1
by: Rune Allnor | last post by:
Hi all. I am sure this is an oldie, but I can't find a useful suggestion on how to solve it. I have a class hierarchy of classes derived from a base class. I would like to set up a vector of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...
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...

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.