Rohmad Hidayat's Blog

Icon

My Notes on Mobile Technology, Python GUI, Python Web Framework, Software Development, Database, Server, Embedded System, Mini Computer

Kenapa OOP enak?

jawaban yang mudah adalah anda tidak usah menulis dua kali,

class Halaman:

def login(self):

cherrypy.session.destroy()

return renderTemplate(file=’login.html’)

def Index(self) :

return renderTemplate(file=’index.html’)

index.exposed=True

class Applikasi(Halaman):

def Main(self,user=None,passwd=None):

if (user==’USER’)&(passwd=’passwd’):

return self.index() <——- cukup dipanggil saja 🙂

else:

return self.login() ,———-sama

Advertisements

Filed under: Computer, Programming, Python

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: