![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
文章平均质量分 72
wangjinhui
这个作者很懒,什么都没留下…
展开
-
A const object can only call const function
consider the following class//=========================================================class cal_date{ public: bool is_leap_year( void ) const ; private: int year ; int month ; int day ;原创 2005-03-26 11:45:00 · 765 阅读 · 0 评论 -
Differenct between return by value and by reference
Consider the following code://==================================1 int max( int& n1, int& n2 )2 {3 if(n1>n2)4 return n1 ;5 else6 return n2 ;7 }8 void main()9 {10原创 2005-04-03 15:40:00 · 768 阅读 · 0 评论 -
Another form of default constructor
Define a book class:class book{public: book( int newISBN = 0, string newName = "" ) ;// Other member functions...private: int ISBN ; string Name ; } ;book::book( int newISBN, int newName ){ ISBN =原创 2005-04-07 20:09:00 · 606 阅读 · 0 评论 -
Which function is called when use virtual function.
class b{public: virtual void mf( int p ) ;} ;void b::mf( int p ){ cout }class d : public b{public: void mf( double p ) ;} ;void d::mf( double p ){ cout }void main(){ b *ptr ; ptr =原创 2005-04-25 15:12:00 · 839 阅读 · 0 评论 -
Which function is called?
class b{public: virtual void mf( int p ) ;} ;void b::mf( int p ){ cout }class d : public b{public: void mf( double p ) ;} ;void d::mf( double p ){ cout }void main(){ b *ptr ; ptr =原创 2005-04-25 15:02:00 · 909 阅读 · 0 评论