Zhenya moved from his parents’ home to study in other city. He didn’t take any cash with him, he only took his father’s credit card with zero balance ...
分类:
其他好文 时间:
2018-10-08 21:37:55
阅读次数:
136
C# 中,可以如下定义: Base father = new Derived(); father 是基类引用,指向子类对象,这一点有点类似C++。 该引用的使用模式如下(先说结论)—— father引用 可以调用所有 非virtual方法(废话); father 会自动调用子类 override方法 ...
1 #include <iostream> 2 #include <string.h> 3 #include <unistd.h> 4 5 using namespace std; 6 7 class Father { 8 private: 9 int money; 10 11 protected: ...
分类:
编程语言 时间:
2018-09-24 00:48:49
阅读次数:
134
(一)覆写:就是子类继承父类,但是子类和父类中都有同样的函数,程序调用的是子类中的函数 1 #include <iostream> 2 using namespace std; 3 class Father{ 4 public: 5 void is_kill(void){ 6 cout<<"fath ...
分类:
编程语言 时间:
2018-09-24 00:33:59
阅读次数:
139
通配符选择器(用来重置网页样式)** *{ padding:0; margin:0; } ul标签去除圆圈 list-style:none; a标签去除下划线 text-decoration:none; 1.高级选择器 后代选择器 ***** 可以是儿子、孙子..... .father ul li ...
分类:
Web程序 时间:
2018-09-18 19:02:44
阅读次数:
185
1. debt father: 120000 sister: 60000 total: 180000 huabei: 1934.82 wangshuangdai: 4166.67 feiqile: 6242.22 jingdongbaitiao: 1165.85 total: 13509.56 da ...
分类:
其他好文 时间:
2018-09-15 23:22:17
阅读次数:
212
我们在程序中定义了一个基类,该基类有n个子类,为了方便,我们经常定义一个基类的指针数组,数组中的每一项指向都指向一个子类,那么在程序中我们如何判断这些基类指针是指向哪个子类呢? 本文提供了两种方法 (1) 自定义类id, (2)typeid 一、自定义id 如下所示基类father有两个子类son1 ...
分类:
编程语言 时间:
2018-09-13 10:23:00
阅读次数:
319
C 面试分享:单例模式 提问1:请给出单例模式的实现: 答: 提问2:继承会破坏单例模式吗? 分析: 说实话,当时这个问题把我给问懵了,没有想明白面试官想考察什么。 下面参考《Head First 设计模式》一书的相关问题,来做一些分析: 首先,就上文的代码而言,子类可以继承Father吗? 答案显 ...
"可持久化并查集" 题意 如题。 解法 我们考虑用主席树来维护每一个版本中,x的father,因为我们要做到可持久化, ~~所以我们不能压缩路径(可能吧)~~ ,我们就需要用到启发式合并。每次将深度较浅的合并到深度较大的集合中,并且,如果两个集合深度相同了的话,将其中的一个深度+1。剩下的就是主席树 ...
分类:
其他好文 时间:
2018-08-24 22:56:56
阅读次数:
209
Description A family consisting of father bear, mother bear and son bear owns three cars. Father bear can climb into the largest car and he likes it. ...
分类:
其他好文 时间:
2018-08-19 11:59:43
阅读次数:
1218