virtual

Calling the overriden method from the base class in C#

Given the following C# class definitions and code: public class BaseClass { public virtual void MyMethod() { ...do something... } } public class A : BaseClass { public override void MyMethod() { ...do something different... } } public class B : BaseClass { public override void MyMethod() ...

what will happen to inline functions inside virtual functions ?

What will happen if I use a inline function inside a virtual function? I'm confused with questions like http://www.parashift.com/c++-faq-lite/value-vs-ref-semantics.html#faq-31.6 I can understand it, but is that mean, it will non-sense to use (call) inline functions inside virtual functions (please assume that it is calling dynamically...

overriden virtual function is not getting called

a more exact version of the code is: class SomeParam; class IBase { public: virtual void Func(SomeParam* param = NULL) { cout << "Base func"; } }; class DerivedA : public IBase { public: void Func() { //do some custom stuff cout << "DerivedA func"; IBase::Func(); } }; class Deriv...

What if I suppress "override"?

I remarked the compiler generates a warning if I suppress the override/new (Overloads/Shadows) keyword. Normally, I set the necessary keyword. But what if i forget it? // >>>> Case A - not virtual property - class MyPoint : Point { int X { get; set; } // vs new int X { get; set; } } // >>>> Case B - virtual property - class Foo ...

Calling virtual functions inside member functions

I'm reading Thinking in C++ by Bruce Eckel. In Chapter 15 (Volume 1) under the heading "Behaviour of virtual functions inside constructor", he goes What happens if you’re inside a constructor and you call a virtual function? Inside an ordinary member function you can imagine what will happen – the virtual call is resolved a...

MFC Virtual List Control using Database

Hi, Does anyone know of a good MFC example of how to create and use a virtual list control with a database that has 100K records? I don't want to load in all the records at once because it takes too much time. I want all updates to the list control to be fast based on user interaction. Thanks, Mike ...

Why can't I use virtual/override on class variables as I can on methods?

In the following example I am able to create a virtual method Show() in the inherited class and then override it in the inheriting class. I want to do the same thing with the protected class variable prefix but I get the error: The modifier 'virtual' is not valid for this item But since I can't define this variable as virtual/ov...

post-it notes in AJAX

I need to create an AJAX widget that would allow a user to simply click on a box and begin typing a few notes. I can take care of the save and edit code. Anyone know of a quick and painless way of going about this? ...

Removing the repeating pattern in C++

Hi, I have atleast 16 functions of the following form. bool Node::some_walker( Arg* arg1 ) { if(this == NULL) return false; bool shouldReturn = false; if( this->some_walker_p(arg1, shouldReturn) ) //This line alone varies return true; if( shouldReturn ) // true is already returned return fal...

Pure Virtual Class and Collections (vector?)

Hello, I'm working on a graphics application that is using virtual classes fairly extensively. It has: A picture class, which is essentially a collection of shapes. A shapes class, which is purely virtual and has a few classes that inherit from it: Circle Polygon Rectangle A Figure shape, which is any graphical figure (also virtual...

Virtual Function Implementation

Hi, I have kept hearing this statement. Switch..Case is Evil for code maintenance, but it provides better performance(since compiler can inline stuffs etc..). Virtual functions are very good for code maintenance, but they incur a performance penalty of two pointer indirections. Say i have a base class with 2 subclasses(X and Y) and ...

Virtual method tables

When discussing sealed classes, the term "virtual function table" is mentioned quite frequently. What exactly is this? I read about a method table a while ago (I don't remember the purpose of the purpose of this either) and a google/search on here brings up C++ related results. Thanks ...

NHibernate: How to disable virtual for class properties?

Hi, how exactly I can use public methods (non-virtual) with NHibernate? I have this code: public string crewNumber { get { return this.crewNumberField; } set { this.crewNumberField = value; } } Note all my classes, properties, methods and interfaces are ...

Virtual microphone, networks and vb.net

I would like to add a virtual microphone (similar to how you can have a virual CD drive and then mount ISO files on it.) so that it can be selectable in programs like MSN and skype. But have the source of the audio be streamed from over a network(I know how to stream the audio over the network in VB.net) but how do I get that audio which...

Virtual functions and polymorphism

Suppose I have this: class A { public: virtual int hello(A a); }; class B : public A { public: int hello(B b){ bla bla }; }; So, A it's an abstract class. 1)In the class B, I'm defining a method that its suppose overrides the A class. But the parameter it's slightly different. I'm not sure about this, is this correct? ...

Abstract base class puzzle

In my class design I ran into the following problem: class MyData { int foo; }; class AbstraktA { public: virtual void A() = 0; }; class AbstraktB : public AbstraktA { public: virtual void B() = 0; }; template<class T> class ImplA : public AbstraktA { public: void A(){ cout << "ImplA A()"; } }; class ImplB ...

How can I create a copy of a vm in vSphere Client running on ESXi 4.0?

I'd like to create copies of the VMs located on my datastore that I can put up temporarily on a different server while I perform some maintenance on our main virtualization server. Aside from using the Converter utility (which I don't believe I can use with the Linux machines) is there a way to make copies of these machines? It would ma...

How to implement a private virtual function within derived classes?

Hi, I know why I want to use private virtual functions, but how exactly can I implement them? For example: class Base{ [...] private: virtual void func() = 0; [...] }; class Derived1: public Base{ void func() { //short implementation is ok here } }; class Derived2: public Base{ void func(); //long implementation elsewhere ...

Calling "Base-Getter" in Overriding Getter of Property

I have a base class "Parent" like this: using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Parent { private int parentVirtualInt = -1; public virtual int VirtualProperty { get { return parentVirtualInt; ...

Can you override private virtual methods?

I think you can and my colleage thinks you cannot! ...