#include <iostream>
class A
{
public:
A(int i)
{
m_A = i;
}
~A()
{
}
static void print()
{
std::cout<< "A" <<std::endl;
}
friend class B;
protected:
int m_A;
private:
};
class B
{
public:
B(int i)
{
m_B = i;
}
static void print()
{
std::cout<< "B" << std::endl;
}
void show(B b)
{
b.a->m_A = 3;
b.m_B = 2;
}
protected:
private:
A* a;
int m_B;
};
template<class T1, class T2>
class CTestTemplate
{
public:
CTestTemplate(T1 t)
{
m_number = t;
}
void print()
{
T2::print();
std::cout<< m_number<< std::endl;
}
protected:
private:
T1 m_number;
};
int main(int argc, char* argv[])
{
CTestTemplate<int, B> testtem(3);
testtem.print();
}
class A
{
public:
A(int i)
{
m_A = i;
}
~A()
{
}
static void print()
{
std::cout<< "A" <<std::endl;
}
friend class B;
protected:
int m_A;
private:
};
class B
{
public:
B(int i)
{
m_B = i;
}
static void print()
{
std::cout<< "B" << std::endl;
}
void show(B b)
{
b.a->m_A = 3;
b.m_B = 2;
}
protected:
private:
A* a;
int m_B;
};
template<class T1, class T2>
class CTestTemplate
{
public:
CTestTemplate(T1 t)
{
m_number = t;
}
void print()
{
T2::print();
std::cout<< m_number<< std::endl;
}
protected:
private:
T1 m_number;
};
int main(int argc, char* argv[])
{
CTestTemplate<int, B> testtem(3);
testtem.print();
}
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/1018/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
评论列表