栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

C++知识点案例 笔记-1

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

C++知识点案例 笔记-1

1.重载函数
2.内联函数
3.New、Delete
4.重载与、const形参
5.常数据成员
6.静态成员函数

==重载函数==
#include 
using namespace std;
void add(int x,int y)
{
    cout< 
 
==内联函数==
#include 
//#include 
using namespace std;
inline void love(int i)
{
    cout<<"我喜欢你"< 
 
==New、Delete==
#include 
#include 
using namespace std;
int main()
{
    int *pi= new int(10);
    cout<<"*pi:"<<*pi< 
 
==重载与、const形参==
#include 
using namespace std;
void func1(const int *x)
{
    cout<<"常量指针:"<<*x< 
 
==常数据成员==
#include 
using namespace std;
class circle
{
public:
    circle(double r);
    double c_c();
private:
    double R;
    const double pai;
};
circle::circle(double r):pai(3.1415926)
{
    R = r;
}
double circle::c_c()
{
    return 2*pai*R ;
}
int main()
{
    cout<<"请输入半径:"<>pk;
    circle q_c(pk);
    cout<<"计算得周长为:"< 
 
==静态成员函数==

#include 
#include 
using namespace std;
class student
{
public:
    student (string name,int id);
    string get_name();
    static int get_total();
    static int get_total(student&stdref);
private:
   static int Total;
   string Name;
   int Id;

};
student::student(string name,int id):Name(name)
{
    Total++;
    Id = id;
}
string student::get_name()
{
    return Name;
}
int student::get_total(student&stdref)
{
    cout<
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/1009664.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号