我有x
类y
静态方法:
class x{
public: static void y(){};
};
我有y
类继承自x
;
我有一个继承自z
的<{1}}类:
y
我可以从class y :public x{};
class z :public y{};
对象中调用多个继承的方法y
:
z
但是从z::y();
y
a
z
个invalid use of 'y::y'
实例调用相同的z a; a.y();
方法错误:
.y
如果y
类是中间继承的,为什么import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import random
data = random.sample(range(100), 5)
data[0] = 100
data[3] = 50
index = ['industry', 'residential', 'agriculture', 'transport', 'other']
df1 = pd.DataFrame(data, index=index, columns=['data'])
df2 = pd.DataFrame(np.array(data)/2, index=index, columns=['data'])
fig = plt.figure()
ax = fig.add_subplot(111, projection="polar")
ax.grid(True)
ax.yaxis.grid(color='r')
ax.xaxis.grid(color='#dddddd')
for spine in ax.spines.values():
spine.set_edgecolor('None')
theta = np.arange(len(df1))/float(len(df1))*2.*np.pi
l1, = ax.plot(theta, df1["data"], color="gold", marker="o", label=None, zorder=1) # , zorder = -3)
l2, = ax.plot(theta, df2["data"], color='tomato', marker="o", label=None, zorder=1.1) #, zorder =-2)
def _closeline(line):
x, y = line.get_data()
x = np.concatenate((x, [x[0]]))
y = np.concatenate((y, [y[0]]))
line.set_data(x, y)
[_closeline(l) for l in [l1, l2]]
ax.fill(theta, df1["data"], "gold", alpha=1, zorder=1)
ax.fill(theta, df2["data"], 'tomato', alpha=1, zorder=1.1)
ax.set_rlabel_position(216)
ax.set_xticks(theta)
ax.set_xticklabels(df2.index, fontsize=12)#, zorder=1)
legend = plt.legend(handles=[l1,l2], labels =['first','second'], loc='lower right')
plt.title("data [unit]", fontsize = 16, y = 1.2)
plt.savefig('atlas//trial2.png', bbox_inches='tight', dpi = 300)
plt.show()
被视为构造函数?