Skip to content

Instantly share code, notes, and snippets.

@carmel4a
Created October 12, 2018 09:53
Show Gist options
  • Save carmel4a/b8cd8477255af2c0112be3cded47440f to your computer and use it in GitHub Desktop.
Save carmel4a/b8cd8477255af2c0112be3cded47440f to your computer and use it in GitHub Desktop.
namespace N
{
template< class T >
foo( T& t );
class Base
{
int x;
int y;
};
class A : Base
{
int restA;
};
class B : Base
{
int restB;
};
}
template< class T >
N::foo( T& t )
{
do_sth_with_t( t );
if( ?? A )
do_sth_with_t_member( t.x );
else if ( ?? B )
do_sth_with_t_member( t.y );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment