free geoip

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is virtual inheritance,generic algorithmswith,member temples
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support
#1
What is virtual inheritance with exampel?

What is generic algorithmswith exampel?

What is member temples?
Reply
#2
Virtual inheritance is a type of inheritance in which the part of the object that belongs to virtual base class becomes common direct base class for derived class and any other class that derives from it. Virtual inheritance is used in multiple inheritance.
Virtual inheritance example in c++:
class Animal{
public:
virtual void eat();
};
// Two classes virtually inheriting Animal:
class Mammal : public virtual Animal {
public:
virtual void walk();
};
class WingedAnimal : public virtual Animal {
public:
virtual void flap();
};
// A bat is a winged mammal
class Bat : public Mammal, public WingedAnimal
{
};
Generic algorithms are those algorithms that are independent of data structures. This can be achieved using Generic Programming in which a function works for all types of containers.
Example:
template void Swap(T & a, T & b) //"&" passes parameters by reference
{
T temp = b;
b = a;
a = temp;
}
string hello = "world!", world = "Hello, ";
Swap( world, hello );
cout << hello << world << endl;
//Output is "Hello, world!"

0300-9520262
Get solution in 24 hour
|cpmputer & internetConfusedmileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  protected inheritance and abstract classes in C++ 2012 Vuhelper 0 1,738 01-14-2012, 05:48 PM
Last Post: Vuhelper
  About C++ for virtual University Students Xpert 2 3,041 06-06-2011, 03:58 AM
Last Post: Xpert
  C++ have Virtual Function vs Function Pointer call 2011 Xpert 0 5,938 05-12-2011, 09:03 PM
Last Post: Xpert
  virtual function and virtual inheritence saneha 1 2,497 05-02-2011, 06:51 PM
Last Post: Vuhelper
  why we use member intilizer list.what is benefit of using it. saneha 1 3,396 05-02-2011, 06:29 PM
Last Post: Vuhelper
  What is the concept of having the data member of the same class within it? i.e. class saneha 1 2,254 05-02-2011, 05:54 PM
Last Post: Vuhelper
  Pointers are not accessible for static member funcion saneha 1 2,322 05-02-2011, 05:48 PM
Last Post: Vuhelper
  difference between member functions,non member functions and friend functions ? saneha 1 5,172 05-02-2011, 04:57 PM
Last Post: Vuhelper
  A data member can be member of any class oject or any particular or there can be any saneha 1 2,209 05-02-2011, 04:50 PM
Last Post: Vuhelper
  what is Member function in c++ 2011 saneha 1 4,085 05-02-2011, 04:46 PM
Last Post: Vuhelper

Forum Jump:


Users browsing this thread: 1 Guest(s)
VU Help • House Banner VU Help Virtual University Students - Assignments, Solved Papers, GDB & Exam Help Student Help Forum • Collaborative • Free Support