码迷,mamicode.com
首页 > 编程语言 > 详细

C++primer4——chapter12

时间:2015-04-02 18:37:40      阅读:126      评论:0      收藏:0      [点我收藏+]

标签:

#include<iostream>

#include<vector>
using namespace std;

/*
class Sales_item
{
public:
	double avg_price()const;
	bool same_isbn(const Sales_item &rhs) const 
	{ return isbn == rhs.isbn; }
	Sales_item(): units_sold(0), revenue(0.0) { }//构造函数
private:
	string isbn; 
	unsigned units_sold; 
	double revenue;
};


double Sales_item::avg_price()const
{
	if(units_sold)
		return revenue/units_sold;
	else
		return 0;
}
*/

/*
class Screen
{
public:
	typedef std::string::size_type index;
	index func(int a.int b);
private:
	index heghit,wight;
	std::string contents;
	std::string::size_type cursor;
	//std::string::size_type heghit,wight;
protected:
};

inline Screen::index Screen::func(Screen::index a,Screen::index b)
{
	return a+b;
}
*/

/*
class Screen { 
public: 
	// interface member functions 
	Screen& move(index r, index c); 
	Screen& set(char); 
	Screen& set(index, index, char); 
	Screen& display(iostream &os)
	{
		do_display(os);
		return *this;
	}
	// other members as before 
private:
	Screen& do_display(iostream &os)const
	{
		//do something displsy
		os<<"what is the func!!"<<endl;
	}
}; 
*/

/*
int hight;
class aa
{
public:
	int diaoyong(int hight)
	{
		return hight;
	}

	int diaoyong1(aa::hight)
	{
		return hight;
	}
	int diaoyong2(::hight)
	{
		return hight;
	}
private:
	int hight,with;
protected:

};
*/

//构造函数
/*
class sales_item
{
public:
	//sales_item():b(2){}
	explicit sales_item(int& c ):b(c){}
	explicit sales_item(istream& ist);
	
	void m_cout()
	{
		cout<<this->b<<endl;
	}
private:
	int b;
	std::string a;
	int revenue;
};
sales_item::sales_item(istream& ist)
{
	ist>>b;
}
*/

//友元,friend
/*
class screen
{
	friend class win_con;
public:
protected:
private:
	int a;
	string b;
	char c;
};
class win_con
{
public:
	win_con& control(screen &s);

};
win_con& win_con::control(screen &s){
	s.a+=1;
	return *this;
}
*/

//static


int main()
{
	//vector<int> a;
	//sales_item my_sales(cin);
	//int x=5;
	//sales_item my_sales(x);
	//my_sales.m_cout();
	system("pause");
	return 1;
   
}

  

C++primer4——chapter12

标签:

原文地址:http://www.cnblogs.com/yanliang12138/p/4387400.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!