c++ overloaded virtual function warning by clang?

This warning is there to prevent accidental hiding of overloads when overriding is intended. Consider a slightly different example: struct chart; // let’s pretend this exists struct Base { virtual void* get(char* e); }; struct Derived: public Base { virtual void* get(chart* e); // typo, we wanted to override the same function }; As it … Read more

What are Virtual Methods?

The Virtual Modifier is used to mark that a method\property(ect) can be modified in a derived class by using the override modifier. Example: class A { public virtual void Foo() //DoStuff For A } class B : A { public override void Foo() //DoStuff For B //now call the base to do the stuff for … Read more

CRTP to avoid dynamic polymorphism

There are two ways. The first one is by specifying the interface statically for the structure of types: template <class Derived> struct base { void foo() { static_cast<Derived *>(this)->foo(); }; }; struct my_type : base<my_type> { void foo(); // required to compile. }; struct your_type : base<your_type> { void foo(); // required to compile. }; … Read more

navigation property should be virtual – not required in ef core?

virtual was never required in EF. It was needed only if you want lazy loading support. Since Lazy loading is not yet supported by EF Core, currently virtual have no special meaning. It would when (and if) they add lazy loading support (there is a plan for doing so). Update: Starting with EF Core 2.1, … Read more

C++ static virtual members?

No, there’s no way to do it, since what would happen when you called Object::GetTypeInformation()? It can’t know which derived class version to call since there’s no object associated with it. You’ll have to make it a non-static virtual function to work properly; if you also want to be able to call a specific derived … Read more

Why use ‘virtual’ for class properties in Entity Framework model definitions?

It allows the Entity Framework to create a proxy around the virtual property so that the property can support lazy loading and more efficient change tracking. See What effect(s) can the virtual keyword have in Entity Framework 4.1 POCO Code First? for a more thorough discussion. Edit to clarify “create a proxy around”: By “create … Read more

Virtual/pure virtual explained

From Wikipedia’s Virtual function … In object-oriented programming, in languages such as C++, and Object Pascal, a virtual function or virtual method is an inheritable and overridable function or method for which dynamic dispatch is facilitated. This concept is an important part of the (runtime) polymorphism portion of object-oriented programming (OOP). In short, a virtual … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)