摘要:        
const int A() //const // ====>int A(const this) { //观点1:const是修饰a,但是通过测试,我们发现,b++也不能编译通过 //这说明:const把a 和 b都修饰了。。。。 //剖析:因为this作为函数的第一个参数,被隐藏。。。。const没    阅读全文
posted @ 2016-02-06 17:05
指尖上的快乐
阅读(185)
评论(0)
推荐(0)
            
        
        
摘要:        
1 #include <iostream> 2 3 using namespace std; 4 5 class Complex 6 { 7 private: 8 int a, b; 9 public: 10 Complex(int a, int b) :a(a), b(b) 11 {} 12 fr    阅读全文
posted @ 2016-02-06 15:25
指尖上的快乐
阅读(262)
评论(0)
推荐(0)
            
        
        
摘要:        
1 #include <iostream> 2 3 using namespace std; 4 5 class Complex 6 { 7 private: 8 int a, b; 9 public: 10 Complex(int a, int b) :a(a), b(b) 11 {} 12 13    阅读全文
posted @ 2016-02-06 13:01
指尖上的快乐
阅读(264)
评论(0)
推荐(0)
            
        
        
摘要:        
友元函数可以修改访问类内部的私有成员, 友元函数的参数之一是类元素,类指针或者是类引用,意思是修改某个对象中的类私有成员(对象一般是访问不了类私有成员的). 若F类是A类的友元类,那么F类的所有成员函数都是A类的友元函数,在F类里声明一个A类的对象a,在F类内部,这个对象a可以直接访问A类的私有成员    阅读全文
posted @ 2016-02-06 10:54
指尖上的快乐
阅读(1324)
评论(0)
推荐(0)
            
        
        
摘要:        
1 #include <iostream> 2 3 using namespace std; 4 5 class Test 6 { 7 public: 8 Test(int a, int b) 9 { 10 this->a = a; 11 this->b = b; 12 } 13 int getA(    阅读全文
posted @ 2016-02-06 09:39
指尖上的快乐
阅读(655)
评论(0)
推荐(0)
    
                    
                
浙公网安备 33010602011771号