Beginning Ethical Hacking with Python by Sanjib Sinha

Beginning Ethical Hacking with Python by Sanjib Sinha

Author:Sanjib Sinha
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA


Understanding Classes and Objects

You cannot understand theory unless you implement that concept into the real world. Let us see what we have learned. 1. Classes are when you create your own object.

2. A class is a blueprint for an object.

3. An object is an instance of a class.

Let us see how we can build a class and later create a few instances from it. Consider this code:

<code>

#!/usr/bin/python3

class Robot:

def __init__(self):

pass

def WalkLikeARobot(self):

print("walks like a robot.")

def CareLikeARobot(self):

print("takes care like a robot.")

robu1 = Robot()

print(type(robu1))

print(id(robu1))

robu2 = Robot()

print(type(robu2))

print(id(robu2))

del robu2

def main():

robu = Robot()

print(type(robu))

print(id(robu))

if __name__ == "__main__":

main()

</code>



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Popular ebooks
Deep Learning with Python by François Chollet(12568)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7778)
Grails in Action by Glen Smith Peter Ledbrook(7696)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6413)
Kotlin in Action by Dmitry Jemerov(5062)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3784)
Mastering Azure Security by Mustafa Toroman and Tom Janetscheck(3327)
Learning React: Functional Web Development with React and Redux by Banks Alex & Porcello Eve(3085)
Mastering Bitcoin: Programming the Open Blockchain by Andreas M. Antonopoulos(2867)
The Art Of Deception by Kevin Mitnick(2604)
Drugs Unlimited by Mike Power(2467)
Kali Linux - An Ethical Hacker's Cookbook: End-to-end penetration testing solutions by Sharma Himanshu(2311)
The Innovators: How a Group of Hackers, Geniuses, and Geeks Created the Digital Revolution by Walter Isaacson(2297)
Writing for the Web: Creating Compelling Web Content Using Words, Pictures and Sound (Eva Spring's Library) by Lynda Felder(2261)
SEO 2018: Learn search engine optimization with smart internet marketing strategies by Adam Clarke(2190)
A Blueprint for Production-Ready Web Applications: Leverage industry best practices to create complete web apps with Python, TypeScript, and AWS by Dr. Philip Jones(2141)
JavaScript by Example by S Dani Akash(2135)
DarkMarket by Misha Glenny(2083)
Wireless Hacking 101 by Karina Astudillo(2075)
Full-Stack React Projects by Shama Hoque(1990)