class

前端学习(391):新春贺卡制作13视口控制

别等时光非礼了梦想. 提交于 2020-01-12 20:25:07
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0,minimum-scale=1, maximum-scale=1,user-scalable=no"> <meta name="format-detection" content="telephone=no"> <meta http-equiv="X-UA-Compatible" content="chrome=1"> <title>新春贺卡</title> <link rel="stylesheet" type="text/css" href="./mooccss/style.css"> </head> <body> <div class="music"> <img src="./moocimg/music_pointer.png" alt=""> <img class="play" id="music" src="./moocimg/music_disc.png" alt=""> </div> <div class="page" id="page1"> <div class="bg"></div> <div class

Why does perl object instance overwrite each other

假如想象 提交于 2020-01-12 10:30:14
问题 I've written some Perl code which compose two classes inherent from a base one. I suppose it would print something like this Mik: Meow! Meow! Sat: Woof! Woof! But it actually print this way: Sat: Woof! Woof! Sat: Woof! Woof! , package Animal; sub new { my $obj = shift; my $name = shift; our %pkg = ( 'name' => $name ); bless \%pkg, $obj; return \%pkg; } package Cat; @ISA = ("Animal"); sub new { my $obj = shift; my $name = shift; my $self = $obj->SUPER::new($name); return $self; } sub get_name

13、python class(1)

好久不见. 提交于 2020-01-12 09:08:54
python class 一、创建class 二、创建实例 1.访问实例的属性 2.调用实例的方法 3.修改实例的属性值 一、创建class class Emp : # __init__() 方法时python的特殊方法,在创建实例时自动运行 # self 参数是必须的,且必须放在第1个参数。self 表示实例本身 def __init__ ( self , No , name , empType , birthday , gender ) : self . No = No self . name = name self . emp_type = empType self . birthday = birthday self . gender = gender def get_work ( self , jobId ) : print ( f '{self.name} do jobId' ) def pay_salary ( self , No , salary ) : print ( f 'pay {self.No} {salary}' ) 二、创建实例 ZhangSan = Emp ( '001' , 'ZhangSan' , '正式' , '1987-10-02' , '男' ) ; 1.访问实例的属性 print ( ZhangSan . No ) print (

TypeError: '<' not supported between instances Python

柔情痞子 提交于 2020-01-12 06:49:06
问题 I am solving a problem with genetic algorithm in python 3. I have not completed the full code yet. I test a part of the code whenever I complete it. At present, I am stuck with an error saying: TypeError: '<' not supported between instances of 'part' and 'part' The interesting thing is, this error does not always show. Sometimes the code runs smoothly and show the desired output, but sometimes it shows this error. What is the reason for this? I am attaching the code and the error message. I

Losing Class information when I use apply in R

跟風遠走 提交于 2020-01-12 06:03:47
问题 When I pass a row of a data frame to a function using apply, I lose the class information of the elements of that row. They all turn into 'character'. The following is a simple example. I want to add a couple of years to the 3 stooges ages. When I try to add 2 a value that had been numeric R says "non-numeric argument to binary operator." How do I avoid this? age = c(20, 30, 50) who = c("Larry", "Curly", "Mo") df = data.frame(who, age) colnames(df) <- c( '_who_', '_age_') dfunc <- function

Losing Class information when I use apply in R

心不动则不痛 提交于 2020-01-12 06:03:33
问题 When I pass a row of a data frame to a function using apply, I lose the class information of the elements of that row. They all turn into 'character'. The following is a simple example. I want to add a couple of years to the 3 stooges ages. When I try to add 2 a value that had been numeric R says "non-numeric argument to binary operator." How do I avoid this? age = c(20, 30, 50) who = c("Larry", "Curly", "Mo") df = data.frame(who, age) colnames(df) <- c( '_who_', '_age_') dfunc <- function

Getting error: ISO C++ forbids declaration of with no type

有些话、适合烂在心里 提交于 2020-01-12 03:57:06
问题 I'm getting the following errors: ISO C++ forbids declaration of ttTreeInsert with no type ISO C++ forbids declaration of ttTreeDelete with no type ISO C++ forbids declaration of ttTreePrint with no type prototype for int ttTree::ttTreePrint() does not match any in class ttTree candidate is: void ttTree::ttTreePrint() Here is my header file: #ifndef ttTree_h #define ttTree_h class ttTree { public: ttTree(void); int ttTreeInsert(int value); int ttTreeDelete(int value); void ttTreePrint(void);

Check for “self-assignment” in copy constructor?

你。 提交于 2020-01-12 03:14:26
问题 Today in university I was recommended by a professor that I'd check for (this != &copy) in the copy constructor, similarly to how you should do it when overloading operator= . However I questioned that because I can't think of any situation where this would ever be equal to the argument when constructing an object. He admitted that I made a good point. So, my question is, does it make sense to perform this checking, or is it impossible that this would screw up? Edit : I guess I was right, but

Check for “self-assignment” in copy constructor?

穿精又带淫゛_ 提交于 2020-01-12 03:14:12
问题 Today in university I was recommended by a professor that I'd check for (this != &copy) in the copy constructor, similarly to how you should do it when overloading operator= . However I questioned that because I can't think of any situation where this would ever be equal to the argument when constructing an object. He admitted that I made a good point. So, my question is, does it make sense to perform this checking, or is it impossible that this would screw up? Edit : I guess I was right, but

Check for “self-assignment” in copy constructor?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-12 03:14:12
问题 Today in university I was recommended by a professor that I'd check for (this != &copy) in the copy constructor, similarly to how you should do it when overloading operator= . However I questioned that because I can't think of any situation where this would ever be equal to the argument when constructing an object. He admitted that I made a good point. So, my question is, does it make sense to perform this checking, or is it impossible that this would screw up? Edit : I guess I was right, but