C++ program to print mirrored right triangle star pattern using virtual base class.
#include<iostream>
using namespace std;
class grand
{
public :
int i;
};
class p1:virtual public grand
{
public :
int j;
};
class p2:virtual public grand
{
public :
int r;
};
class derived:public p1,public p2
{
public :
int patern()
{
cout<<"input No of rows : ";
cin>>r;
for(j=1 ; j<=r ; j++)
{
for(i=j ; i<r ; i++)
{
cout<<" ";
}
for(i=1 ; i<=j ; i++)
{
cout<<"*";
}
cout<<"\n";
}
}
};
int main()
{
derived a;
a.patern();
}
Output
mirrored inverted right triangle star pattern in C++ by using the virtual base class.
C++ program to print right triangle star pattern by using the virtual base class.
hollow right triangle star pattern in C++ by using the virtual base class.
star pattern programs in C++ using for while loop by using the virtual base class.
c++ programming pattern by using the virtual base class.
c++ star triangle by using the virtual base class.
hollow mirrored right triangle star pattern in C++ by using the virtual base class.
