随笔分类 -  C++

摘要:#include<iostream>using namespace std; class Base{ public: void fn1(){ cout<<"Base fn1开始"<<endl; } void fn2(){ cout<<"Base fn2开始"<<endl; }};class Deri 阅读全文
posted @ 2023-04-14 22:01 不会JAVA的小袁 阅读(12) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>#include<stdlib.h>using namespace std;class Object{ public: Object() { cout<<"Object构造函数"<<endl; weight=0; } ~Object() { cout<<"Obje 阅读全文
posted @ 2023-04-14 21:48 不会JAVA的小袁 阅读(10) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Base{ public: Base(){}; void fn1()const{ cout<<"调用fn1"<<endl; } void fn2()const{ cout<<"调用fn2"<<endl; }};c 阅读全文
posted @ 2023-04-14 21:31 不会JAVA的小袁 阅读(6) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>#include<string>using namespace std;class Document{ public: Document(){ cin>>name; } void Display()const{ cout<<"Name:"<<name<<endl; 阅读全文
posted @ 2023-04-14 21:13 不会JAVA的小袁 阅读(10) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>using namespace std;class Mammal{ public: Mammal(){ cout<<"Mammal构造"<<endl; } ~Mammal(){ cout<<"析构Mammal"<<endl; }}; class Dog:publ 阅读全文
posted @ 2023-04-13 21:30 不会JAVA的小袁 阅读(11) 评论(0) 推荐(0) 编辑
摘要:#include <iostream>#define pi 3.14using namespace std; class Shape{public: virtual float getArea(){return 0;} virtual ~Shape(){}};class Rectangle:publ 阅读全文
posted @ 2023-04-13 21:25 不会JAVA的小袁 阅读(13) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Base0{ public: int var0; void fun0(){ cout<<"Member of Base0"<<endl; }};class Base1:virtual public Base0{ 阅读全文
posted @ 2023-04-13 21:03 不会JAVA的小袁 阅读(12) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Base0{ public: int var0; void fun0(){ cout<<"Member of Base0"<<endl; }};class Base1:public Base0{ public: 阅读全文
posted @ 2023-04-12 21:54 不会JAVA的小袁 阅读(11) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Base1{ public: int var; void fun() { cout<<"Membber of Base1"<<endl; } };class Base2{ public: int var; voi 阅读全文
posted @ 2023-04-12 21:43 不会JAVA的小袁 阅读(10) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Base1{ public: Base1(int i){ cout<<"Constructing Base1"<<i<<endl; } Base1(){ cout<<"Constructing Base1"<<e 阅读全文
posted @ 2023-04-12 21:26 不会JAVA的小袁 阅读(14) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;class Base1{ public: Base1(int i){ cout<<"Constructing Base1"<<i<<endl; }};class Base2{ public: Base2(int j){ co 阅读全文
posted @ 2023-04-12 21:15 不会JAVA的小袁 阅读(13) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;int main(){ int x,y; cout<<"Enter x and y:"; cin>>x>>y; if(x!=y) if(x>y) cout<<"x>y"<<endl; else cout<<"x<y"<<en 阅读全文
posted @ 2023-04-10 20:53 不会JAVA的小袁 阅读(17) 评论(0) 推荐(0) 编辑
摘要:#include<iostream>using namespace std;int main(){ int year; bool isLeapYear; cout<<"Enter the year:"; cin>>year; isLeapYear=((year% 4==0&&year% 100!=0 阅读全文
posted @ 2023-04-10 20:38 不会JAVA的小袁 阅读(13) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示