virtual-functions Questions

2

Solved

I have a parent class with one important abstract procedure which I am overloading in many child classes as the example code shown below: TCParent = Class private public procedure SaveConfig; vir...
Nickolenicks asked 5/12, 2012 at 1:16

4

Solved

class A { public: void operator=(const B &in); private: int a; }; class B { private: int c; } sorry. there happened an error. is assignment operator valid ? or is there any way to achieve...
Eden asked 8/4, 2009 at 8:10

3

Solved

I have been reading about Virtual functions and found, VF are used in polymorphism of an inherited class. So , if a class and derived class both have the same function name, VF binds the approp...
Cortes asked 23/10, 2012 at 3:10

3

Solved

I'm trying for half an eternity now overriding QWidgets keyPressEvent function in QT but it just won't work. I've to say i am new to CPP, but I know ObjC and standard C. My problem looks like this...
Depository asked 28/4, 2010 at 22:56

1

Solved

I would like to execute some virtual methods in a cuda kernel, but instead of creating the object in the same kernel I would like to create it on the host and copy it to gpu memory. I am successfu...
Disfigure asked 3/10, 2012 at 2:32

2

Solved

Here is my example code which produces the error: struct Impl { int data_size_; int find(int var){return 0;} int get(int rowid){return 0;} }; class Container { public: Container() {} virtual...
Oberon asked 27/9, 2012 at 7:6

3

Solved

I have this code: class Class { public: virtual void first() {}; virtual void second() {}; }; Class* object = new Class(); object->first(); object->second(); delete object; that I compi...
Mindy asked 18/9, 2012 at 7:48

1

Solved

Possible Duplicate: Undefined symbols “vtable for …” and “typeinfo for…”? C++ Undefined Reference to vtable and inheritance I've a problem with ...
Saccharide asked 14/9, 2012 at 11:23

2

Solved

Was looking at some code in our codebase and I'm unable to understand how/why this is even working (and not causing a stackoverflow due to infinite recursion). I have pasted some equivalent code be...
Birddog asked 11/9, 2012 at 17:32

2

Solved

It isn't clear what happens if I delete a virtual method in C++0x: virtual int derive_func() = delete; Does this mean this class and everything that inherits from it can not define/implement th...
Saxtuba asked 11/10, 2010 at 21:25

5

Solved

My library has two classes, a base class and a derived class. In the current version of the library the base class has a virtual function foo(), and the derived class does not override it. In the n...

4

A virtual function's return type should be the same type that is in base class, or covariant. But why do we have this restriction?
Anatomize asked 28/1, 2011 at 8:47

6

Solved

I have two classes - one base class and one derived from it : class base { int i ; public : virtual ~ base () { } }; class derived : virtual public base { int j ; }; main() { cout <<...
Saffier asked 5/6, 2012 at 19:24

4

Solved

In virtual constructor idiom there are virtual functions which returns new object OR copy of the object using virtual functions. But then to call these virtual functions polymorphic way, you must h...
Araarab asked 20/7, 2012 at 6:39

2

Solved

I understand what is java method invocation and have practiced many examples using it. I want to know what is the practical situation or need of this concept. It would be of great help if an...
Hip asked 11/7, 2012 at 10:59

3

Solved

This is from the C++11 standard sec 12.7.4. This is rather confusing. What does the last sentence in the text mean exactly? Why is the last method call in B::B undefined? Shoudn't it just call a....

3

Solved

The title is probably confusing. Suppose we have the following set up; class A { public: virtual void fn() = 0; }; class B { public: virtual int fn() {}; }; class C: public A, public B ...
Selfdetermination asked 6/9, 2011 at 11:55

3

Solved

If I have two abstract classes defining a pure virtual function with the same name, but different, non-covariant return types, how can I derive from these and define an implementation for both thei...

4

Solved

this is a small code which shows virtual methods. class A { public virtual void F() { Console.WriteLine("A.F"); } } class B: A { public override void F() { Console.WriteLine("B.F"); } } class C:...
Arquit asked 6/7, 2012 at 5:26

8

Solved

When implementing polymorphic behavior in C++ one can either use a pure virtual method or one can use function pointers (or functors). For example an asynchronous callback can be implemented by: Ap...
Bowman asked 23/12, 2009 at 20:17

3

In C#, we have concept about abstract method, and how to apply this in Javascript. Example, I have an example: function BaseClass() { this.hello = function() { this.talk(); } this.talk = funct...
Cimex asked 19/6, 2012 at 7:58

2

Solved

As I understand, the location of the virtual function pointer table in an object is compiler dependent. Are there any pros/cons of placing this pointer at the beginning of the object vs at the end ...
Tenth asked 7/6, 2012 at 3:2

2

How can we know the address of the VTABLEs (i.e corresponding vptr) using the objdump utility and dissembled code. vptr is generally stored in the first byte of object .(correct/edit this). There i...
Lepidus asked 11/5, 2012 at 10:3

3

Solved

Consider the following code: class Base { public: virtual void Foo() {} }; class Derived : public Base { private: void Foo() {} }; void func() { Base* a = new Derived; a->Foo(); //fine, ca...
Hoshi asked 27/4, 2012 at 6:35

3

Solved

I have a C++ application. This supports users' C++ plugin DLL's, it will dynamically load these DLL's and then be able to create and use the user's types dynamically. These user types derive from b...
Berndt asked 1/6, 2011 at 20:41

© 2022 - 2024 — McMap. All rights reserved.