class

Access private elements of object of same class

孤人 提交于 2019-12-30 03:20:07
问题 Is this legal? If not, will the following code allow this? class Foo { friend class Foo; } 回答1: That's redundant. Foo already has access to all Foo members. Two Foo objects can access each other's members. class Foo { public: int touchOtherParts(const Foo &foo) {return foo.privateparts;} private: int privateparts; }; Foo a,b; b.touchOtherParts(a); The above code will work just fine. B will access a's private data member. 回答2: Yes it is legal for an object of class Foo to access the private

Consequences of changing inheritance to virtual?

怎甘沉沦 提交于 2019-12-30 03:13:25
问题 I'm working on a huge project that I didn't start. My task is to add some additional functionality to what already is there. I'm in a situation where I have to use virtual inheritance because I have a diamond model. The situation is depicted in the following illustration: Base class / \ / \ My new class A class that was there before (OldClass) \ / \ / \ / \ / My other new class For this to work, both the classes in the middle have to inherit from the base through public virtual instead of

Is there a benefit in using old style `object` instead of `class` in Delphi?

≯℡__Kan透↙ 提交于 2019-12-30 03:11:09
问题 In Delphi sane people use a class to define objects. In Turbo Pascal for Windows we used object and today you can still use object to create an object. The difference is that a object lives on the stack and a class lives on the heap. And of course the object is depreciated. Putting all that aside: is there a benefit to be had, speed wise by using object instead of class? I know that object is broken in Delphi 2009, but I've got a special use case 1) where speed matters and I'm trying to find

How to extract field value from PDF form in PHP

你说的曾经没有我的故事 提交于 2019-12-30 03:11:07
问题 We are developing PHP & MySQL based application. We distribute a registration form in PDF format. After filling form, user will upload PDF form to our application to register. We want to extract registration data in PDF form from PHP and save these data to database. Can someone point me PHP classes for extracting field value from PDF form? 回答1: An alternative could be using an external program like http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/ and so something like: $ pdftk file.pdf

Is there a benefit in using old style `object` instead of `class` in Delphi?

假装没事ソ 提交于 2019-12-30 03:11:03
问题 In Delphi sane people use a class to define objects. In Turbo Pascal for Windows we used object and today you can still use object to create an object. The difference is that a object lives on the stack and a class lives on the heap. And of course the object is depreciated. Putting all that aside: is there a benefit to be had, speed wise by using object instead of class? I know that object is broken in Delphi 2009, but I've got a special use case 1) where speed matters and I'm trying to find

Accessing the Document class in AS3

折月煮酒 提交于 2019-12-30 03:03:09
问题 How can instantiated classes access the Document class? Even after I name the Document class using the Properties bar in Flash, attempting to access it from other classes usually fails, saying "attempting to access an undefined property... One solution is always casting the Document class to itself! eg. Main(Main).globalMethod(); But sometimes even this stellar gotcha fails, and then there's usually no way out, apart from the obvious! class Other{ var parentClass:Main; public function Other

快捷键/光标

爱⌒轻易说出口 提交于 2019-12-30 00:28:17
1、快捷键 Button自带属性:accesskey 按Alt + U 或Ctrl+Alt+U触发快捷键 <button id="btn_edit_list" type="button" class="btn btn-primary" accesskey="U"> <span class="fa fa-pencil" aria-hidden="true"></span>@Messages.common_btn_edit </button> 问题:不论是否打开Modal div,快捷键都会触发(对话框的消失会删除body的modal-open class属性) 修改:一般来说,在一个modal上不能再打开另一个modal。所以,在所有快捷键事件中,增加 body 是否包含 modal-open CSS的判断。 //edit button event $("#btn_edit_list").click(function () { if ($("body").hasClass('modal-open')) return; ...... }); 2、光标 设置一打开modal的光标位置: 新规/编辑: 光标位置默认在模态框中第一个、可见的、可编辑的、排除只读的控件 readonly:只读、可复制 disabled:只读、不可复制 $("#detailModal").on("shown.bs

5.表单

喜你入骨 提交于 2019-12-30 00:24:39
1.基本表单实例 .form-control类的<input> <textarea> <select>元素等都被默认设置宽度属性为width:100% .form-group{ margin-bottom : 15px; } <form> <div class="form-group"> <label for="u_email">邮箱</label> <input type="email" class="u_email form-control" id="u_email" placeholder="请填写邮箱地址"> </div> <div class="form-group"> <label for="u_password">密码</label> <input type="password" class="u_password form-control" id="u_password" placeholder="请填写密码"> </div> <div class="form-group"> <label for="inputfile">上传文件</label> <input type="file" id="inputfile"> <p class="help-block">帮助提示文本区域</p> </div> <div class="checkbox"> <label>

页面布局

我是研究僧i 提交于 2019-12-29 23:03:32
/*外边距 顺序 上右下左 */ /*margin: 100px 0px 30px 40px;*/ /*内边距*/ /*padding: 100px 0px 30px 20px;*/ <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> .div1,.div2{ width: 100px; height: 100px; background-color: red; } .div2{ background: blue; /*padding-top:50px; margin-left: 50px;*/ margin: 100px 0px 0px 50px; } .banner{ width: 100px; height: 100px; background-color: yellow; /*浮动定位*/ position: fixed; bottom: 0px; right: 0px; } .div-relative{ width: 100px; height: 100px; background-color: red; /*相对定位*/ position: relative; } .div-absolute{ width: 20px; height: 20px; background

Protected Member Access

社会主义新天地 提交于 2019-12-29 10:15:35
https://msdn.microsoft.com/en-us/library/bcd5672a.aspx 官方的说法 The protected keyword is a member access modifier. A protected member is accessible within its class and by derived class instances. protected关键字是一个成员访问修饰符。一个protected的成员,一个protected成员,在其所在的类中,可由其派生类的实例访问。 可访问性级别的介绍: https://msdn.microsoft.com/en-us/library/ba0a1yw2.aspx protected :Access is limited to the containing class or types derived from the containing class. protected关键字:只能由包含的类进行访问,或者从包含该成员的类所派生的类进行访问。 疑惑的地方: 错误观点 我本以为 只要是派生类的实例,就可以访问受保护的成员 。 子类的实例,可以赋值给父类类型的变量。通过父类类型的变量,是不允许访问protected成员的。 http://blogs.msdn.com/b